diff --git a/src/main/java/de/hsel/itech/jsf/UserBean.java b/src/main/java/de/hsel/itech/jsf/UserBean.java index 149b4ee..203a2f1 100644 --- a/src/main/java/de/hsel/itech/jsf/UserBean.java +++ b/src/main/java/de/hsel/itech/jsf/UserBean.java @@ -19,6 +19,10 @@ public class UserBean { @Setter private String username; + @Getter + @Setter + private String email; + @Getter @Setter private String password; @@ -27,7 +31,7 @@ public class UserBean { private boolean loggedIn = false; @Getter - private boolean correctPassword = true; + private boolean error = false; public String login() { @@ -35,19 +39,39 @@ public class UserBean { User user = db.user().get(username); if (user == null) { - correctPassword = false; + error = true; return ""; } if (db.user().verify(user, password)) { loggedIn = true; this.user = user; + password = null; + username = null; return "index.xhtml"; } - correctPassword = false; + error = true; return ""; + } + public String logout() { + user = null; + return "index.html"; + } + public String register() { + Database db = Database.getInstance(); + + if(username != null && email != null && password != null) { + User user = new User(email, username, password, (short) 1); + db.user().insert(user); + email = null; + username = null; + password = null; + return "login.xhtml"; + } + + return ""; } } \ No newline at end of file diff --git a/src/main/webapp/index.html b/src/main/webapp/index.html deleted file mode 100644 index 57218fe..0000000 --- a/src/main/webapp/index.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - Internet Technologien - - - - - \ No newline at end of file diff --git a/src/main/webapp/index.xhtml b/src/main/webapp/index.xhtml new file mode 100644 index 0000000..81186d3 --- /dev/null +++ b/src/main/webapp/index.xhtml @@ -0,0 +1,19 @@ + + + + + + + + + Hallo Welt!!! + + + + + + diff --git a/src/main/webapp/login.xhtml b/src/main/webapp/login.xhtml index 2571f88..3f05980 100644 --- a/src/main/webapp/login.xhtml +++ b/src/main/webapp/login.xhtml @@ -10,7 +10,7 @@ - + @@ -23,11 +23,14 @@
Passwort - Login + + Noch kein Account ? + +
diff --git a/src/main/webapp/logout.xhtml b/src/main/webapp/logout.xhtml new file mode 100644 index 0000000..09499d1 --- /dev/null +++ b/src/main/webapp/logout.xhtml @@ -0,0 +1,19 @@ + + + + + + + + Sind Sie sich sicher ? + + + + + + + diff --git a/src/main/webapp/register.xhtml b/src/main/webapp/register.xhtml new file mode 100644 index 0000000..3dae1c5 --- /dev/null +++ b/src/main/webapp/register.xhtml @@ -0,0 +1,29 @@ + + + + + + + +
+
+ + Nutzername +
+ Email +
+ Passwort + + +
+
+
+ +
+
+
+ diff --git a/src/main/webapp/template.xhtml b/src/main/webapp/template.xhtml index c1b8873..28d705f 100644 --- a/src/main/webapp/template.xhtml +++ b/src/main/webapp/template.xhtml @@ -37,19 +37,30 @@