Skip to content
Snippets Groups Projects
Commit b541f4bb authored by SIMONVOLLENDORF\Simon's avatar SIMONVOLLENDORF\Simon
Browse files

-Bearbeitung der RegView, -DAO und -Control

parent 20db9599
No related branches found
No related tags found
No related merge requests found
...@@ -16,7 +16,7 @@ import org.s4s.services.db.JDBCConnection; ...@@ -16,7 +16,7 @@ import org.s4s.services.db.JDBCConnection;
*/ */
public class RegistrationDAO extends AbstractDatabaseClass { public class RegistrationDAO extends AbstractDatabaseClass {
Statement st = JDBCConnection.getInstance().getStatement(); Statement st;
String sql_update; String sql_update;
public void addUser(String benutzer, String nachname, String vorname, java.util.Date gebDate, int fBereich, String email, String emailwdh, String passwort, String passwortWdh) { public void addUser(String benutzer, String nachname, String vorname, java.util.Date gebDate, int fBereich, String email, String emailwdh, String passwort, String passwortWdh) {
...@@ -24,7 +24,7 @@ public class RegistrationDAO extends AbstractDatabaseClass { ...@@ -24,7 +24,7 @@ public class RegistrationDAO extends AbstractDatabaseClass {
sql_update = "INSERT INTO \"ERR\".\"user\"(benutzername, nachname, vorname, geburtsdatum, fachbreichid, email, passwort)" + sql_update = "INSERT INTO \"ERR\".\"user\"(benutzername, nachname, vorname, geburtsdatum, fachbreichid, email, passwort)" +
"VALUES(\'" + benutzer + "\', \'" + nachname + "\', \'" + vorname + "\', \'" + gebDate + "\', \'" + fBereich + "\', \'" + email + "\', \'" + passwort + "\')"; "VALUES(\'" + benutzer + "\', \'" + nachname + "\', \'" + vorname + "\', \'" + gebDate + "\', \'" + fBereich + "\', \'" + email + "\', \'" + passwort + "\')";
int exe = st.executeUpdate(sql_update); int exe = JDBCConnection.getInstance().getStatement().executeUpdate(sql_update);
if(exe < 0) { if(exe < 0) {
throw new WrongInputException("Wrong Input!"); throw new WrongInputException("Wrong Input!");
} }
......
...@@ -19,10 +19,7 @@ import org.s4s.exceptions.WrongInputException; ...@@ -19,10 +19,7 @@ import org.s4s.exceptions.WrongInputException;
*/ */
public class RegistrationControl { public class RegistrationControl {
//User-Block //User-Block
private static String nachname;
private static String vorname;
private static String email; private static String email;
private static String passwort;
private static RegistrationDAO regDAO = new RegistrationDAO(); private static RegistrationDAO regDAO = new RegistrationDAO();
...@@ -59,14 +56,14 @@ public class RegistrationControl { ...@@ -59,14 +56,14 @@ public class RegistrationControl {
throw new WrongInputException("Vorname enthält ungültige Zeichen!"); throw new WrongInputException("Vorname enthält ungültige Zeichen!");
} }
if (!passwordValidator()) { if (!passwordValidator(passwort)) {
throw new WrongInputException("Passwort ungültig!"); throw new WrongInputException("Passwort ungültig!");
} }
} catch(WrongInputException w) { } catch(WrongInputException w) {
w.printStackTrace(); w.printStackTrace();
System.out.println("Exception occur: " + w.getMessage()); System.out.println("Exception occur: " + w.getMessage());
} }
regDAO.addUser(benutzer, nachname, vorname, gebDate, fBereich, email, emailwdh, passwort, passwortWdh); regDAO.addUser(benutzer, nachname, vorname, gebDate, fBereich, email, emailwdh, passwort, passwortWdh);
} }
...@@ -85,7 +82,7 @@ public class RegistrationControl { ...@@ -85,7 +82,7 @@ public class RegistrationControl {
return EmailValidator.getInstance().isValid(email); return EmailValidator.getInstance().isValid(email);
} }
public static boolean passwordValidator() { public static boolean passwordValidator(String passwort) {
return passwort.length() > 8; return passwort.length() > 8;
/* String regex = "^.*(?=.{8,})(?=..*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&+=]).*$"; /* String regex = "^.*(?=.{8,})(?=..*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&+=]).*$";
......
...@@ -51,6 +51,7 @@ public class RegistrierungView extends TemplateView implements View { ...@@ -51,6 +51,7 @@ public class RegistrierungView extends TemplateView implements View {
content.addComponent(benutzername); content.addComponent(benutzername);
DateField bday = new DateField("Geburtstag"); DateField bday = new DateField("Geburtstag");
bday.setDateFormat("YYYY-MM-DD");
content.addComponent(bday); content.addComponent(bday);
TextField nachnameTxt = new TextField("Nachname:"); TextField nachnameTxt = new TextField("Nachname:");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment