}
@Override
protected void onSubmit() {
IModel<User> userModel = UserService.get().getByEmail(email.getModelObject());
User user = userModel.getObject();
if (user != null) {
Databinder.getHibernateSession().beginTransaction();
user.generateSecurityToken();
Databinder.getHibernateSession().getTransaction().commit();
String url = "/password?username=" + user.getUsername() + "&key=" + user.getSecurityToken();
((ISIEmailService) EmailService.get()).sendXmlEmail(userModel, ISIEmailService.EMAIL_FORGOT, url);
String passwordSent = new StringResourceModel("ForgotPassword.passwordSent", this, null,
"Thank you! In a few minutes you should get an email. You will need to click on the link in that email to reset your password.").getString();
info(passwordSent);
success = true;