public void createNewUser() { // TODO make error and ok messages.. make local strings // TODO-maybe: make required password length(and double type it) and check for correct email // format if (firstNameCreateUserText.getText().equals("") && lastNameCreateUserText.getText().equals("") && userNameCreateUserText.getText().equals("") && passwordCreateUserText.getText().equals("") && emailCreateUserText.getText().equals("")) { emptyFieldErrorLbl.setVisible(true); createUserErrorLbl.setVisible(false); succesLbl.setVisible(false); } if (logic.createUser( firstNameCreateUserText.getText(), lastNameCreateUserText.getText(), userNameCreateUserText.getText(), passwordCreateUserText.getText(), emailCreateUserText.getText())) { logic.createGame("alexGameTest", "wwwdddssss"); emptyFieldErrorLbl.setVisible(false); createUserErrorLbl.setVisible(false); succesLbl.setVisible(true); } else { emptyFieldErrorLbl.setVisible(false); createUserErrorLbl.setVisible(true); succesLbl.setVisible(false); } }
public void Login() throws IOException { // TODO set username og password til en string istedet for at hent dem på den måde // if username field is empty = error message if (usernameText.getText().equals("")) { passwordErrorLbl.setVisible(false); usernameErrorLbl.setVisible(true); loginErrorLbl.setVisible(false); } // if passwordfield is empty = error message if (passwordText.getText().equals("")) { usernameErrorLbl.setVisible(false); passwordErrorLbl.setVisible(true); loginErrorLbl.setVisible(false); } if (passwordText.getText().equals("") && usernameText.getText().equals("")) { usernameErrorLbl.setVisible(true); passwordErrorLbl.setVisible(true); loginErrorLbl.setVisible(false); } if (logic.userAuth(usernameText.getText(), passwordText.getText())) { usernameErrorLbl.setVisible(false); passwordErrorLbl.setVisible(false); loginErrorLbl.setVisible(false); usernameText.clear(); passwordText.clear(); // TODO get menu to display currentuser myController.setScreen(Main.screenMenuID); } else { usernameErrorLbl.setVisible(false); passwordErrorLbl.setVisible(false); loginErrorLbl.setVisible(true); } }
public void logout() throws IOException { logic.setCurrentUser(null); myController.setScreen(Main.screenLoginID); }