Mapping.begin();
User user = User.getInstance(login);
Mapping.rollback();
if (!lform.getPassword().equals(user.getPassword())) {
ActionError error = new ActionError("error.login.badPassword");
ActionErrors errors = new ActionErrors();
errors.add("password", error);
request.setAttribute(ERROR_KEY, errors);
return (new ActionForward(mapping.getInput()));
}
Mapping.begin();
boolean result = new SecurityManagerImpl().canLogIntoBackoffice(user);
Mapping.rollback();
if ( !result ) {
ActionError error = new ActionError("error.login.notAuthorized");
ActionErrors errors = new ActionErrors();
errors.add("login", error);
request.setAttribute(ERROR_KEY, errors);
return (new ActionForward(mapping.getInput()));
}
request.getSession().setAttribute("userLogin",user.getLogin());
} catch (Exception e) {
Mapping.rollback();
ActionError error = new ActionError("error.login.badLogin");
ActionErrors errors = new ActionErrors();
errors.add("login", error);
request.setAttribute(ERROR_KEY, errors);
return (new ActionForward(mapping.getInput()));
}
// Forward to the newt page