/**
  * Do change password.
  *
  * @return the result
  */
 @SubjectPresent
 public static Result doChangePassword() {
   com.feth.play.module.pa.controllers.Authenticate.noCache(response());
   final Form<Account.PasswordChange> filledForm = PASSWORD_CHANGE_FORM.bindFromRequest();
   if (filledForm.hasErrors()) {
     // User did not select whether to link or not link
     return badRequest(password_change.render(filledForm));
   } else {
     final User user = ControllerUtil.getLocalUser(session());
     final String newPassword = filledForm.get().password;
     user.changePassword(new EmailAuthUser(newPassword), true);
     flash(
         ControllerUtil.FLASH_INFO_KEY, Messages.get("playauthenticate.change_password.success"));
     return redirect(routes.Application.profile());
   }
 }
 /**
  * Verify email.
  *
  * @return the result
  */
 @SubjectPresent
 public static Result verifyEmailById(Long userId) {
   com.feth.play.module.pa.controllers.Authenticate.noCache(response());
   final User user = User.findById(userId);
   if (user.emailValidated) {
     // E-Mail has been validated already
     flash(
         ControllerUtil.FLASH_INFO_KEY,
         Messages.get("playauthenticate.verify_email.error.already_validated"));
   } else if ((user.email != null) && !user.email.trim().isEmpty()) {
     flash(
         ControllerUtil.FLASH_INFO_KEY,
         Messages.get("playauthenticate.verify_email.message.instructions_sent", user.email));
     EmailAuthProvider.getProvider().sendVerifyEmailMailingAfterSignup(user, ctx());
   } else {
     flash(
         ControllerUtil.FLASH_INFO_KEY,
         Messages.get("playauthenticate.verify_email.error.set_email_first", user.email));
   }
   return redirect(routes.Application.profile());
 }