use of amu.zhcet.auth.password.PasswordChange in project zhcet-web by zhcet-amu.
the class PasswordChangeController method changePassword.
@GetMapping
public String changePassword(Model model) {
User user = userService.getLoggedInUser().orElseThrow(UserNotFoundException::new);
if (!user.isEmailVerified()) {
log.warn("User not verified and tried to change the password!");
model.addAttribute("error", "The user is not verified, and hence can't change the password");
} else {
if (!model.containsAttribute("password")) {
PasswordChange passwordChange = new PasswordChange();
model.addAttribute("password", passwordChange);
}
model.addAttribute("blacklist", Arrays.asList(user.getName(), user.getEmail(), user.getUserId()));
}
return "user/change_password";
}
Aggregations