use of org.craftercms.profile.exceptions.NoSuchVerificationTokenException in project profile by craftercms.
the class ProfileServiceImpl method verifyProfile.
@Override
public Profile verifyProfile(String verificationTokenId, final String... attributesToReturn) throws ProfileException {
VerificationToken token = verificationService.getToken(verificationTokenId);
if (token == null) {
throw new NoSuchVerificationTokenException(verificationTokenId);
}
Profile profile = updateProfile(token.getProfileId(), profileUpdater -> {
profileUpdater.setEnabled(true);
profileUpdater.setVerified(true);
}, attributesToReturn);
verificationService.deleteToken(verificationTokenId);
logger.debug(LOG_KEY_PROFILE_VERIFIED, profile.getId());
return profile;
}
use of org.craftercms.profile.exceptions.NoSuchVerificationTokenException in project profile by craftercms.
the class ProfileServiceImpl method changePassword.
@Override
public Profile changePassword(String resetTokenId, final String newPassword, final String... attributesToReturn) throws ProfileException {
VerificationToken token = verificationService.getToken(resetTokenId);
if (token == null) {
throw new NoSuchVerificationTokenException(resetTokenId);
}
Profile profile = updateProfile(token.getProfileId(), profileUpdater -> profileUpdater.setPassword(CryptoUtils.hashPassword(newPassword)), attributesToReturn);
verificationService.deleteToken(resetTokenId);
logger.debug(LOG_KEY_PASSWORD_CHANGED, profile.getId().toString());
return profile;
}
Aggregations