use of com.tap5.hotelbooking.security.AuthenticationException in project tapestry5-hotel-booking by ccordenier.
the class Signup method proceedSignup.
@OnEvent(value = EventConstants.SUCCESS, component = "RegisterForm")
public Object proceedSignup() {
User userVerif = crudServiceDAO.findUniqueWithNamedQuery(User.BY_USERNAME_OR_EMAIL, QueryParameters.with("username", username).and("email", email).parameters());
if (userVerif != null) {
registerForm.recordError(messages.get("error.userexists"));
return null;
}
User user = new User(fullName, username, email, password);
crudServiceDAO.create(user);
try {
authenticator.login(username, password);
} catch (AuthenticationException ex) {
registerForm.recordError("Authentication process has failed");
return this;
}
return Search.class;
}
use of com.tap5.hotelbooking.security.AuthenticationException in project tapestry5-hotel-booking by ccordenier.
the class BasicAuthenticator method login.
public void login(String username, String password) throws AuthenticationException {
User user = crudService.findUniqueWithNamedQuery(User.BY_CREDENTIALS, QueryParameters.with("username", username).and("password", password).parameters());
if (user == null) {
throw new AuthenticationException("The user doesn't exist");
}
request.getSession(true).setAttribute(AUTH_TOKEN, user);
}
Aggregations