}
@Override
protected void onSubmit() {
log.info("Login::onSubmit");
ISISession session = ISISession.get();
if(session.signIn((String)username.getModelObject(), (String)password.getModelObject())){
eventService.createLoginSession(getRequest());
eventService.saveLoginEvent();
User user = session.getUser();
if (!user.isValid()) {
String notConfirmed = new StringResourceModel("Login.notConfirmed", this, null, "Account not confirmed.").getString();
error(notConfirmed);
return;
}
// Set default Period
if (user != null && user.usesPeriods()) {
session.setCurrentPeriodModel(new HibernateObjectModel<Period>(user.getPeriods().iterator().next()));
Site currentSite = ISISession.get().getCurrentPeriodModel().getObject().getSite();
IModel<Site> mCurrentSite = new Model<Site>(currentSite);
session.setCurrentSiteModel(mCurrentSite);
}
if (!continueToOriginalDestination()) {
setResponsePage(getApplication().getHomePage());
setRedirect(true);