List of usage examples for org.springframework.security.core.userdetails UsernameNotFoundException getCause
public synchronized Throwable getCause()
From source file:org.musicrecital.webapp.pages.PasswordRecoveryToken.java
Object onActivate(EventContext ctx) {
// ensure that the username has been set
if (ctx == null || ctx.getCount() == 0) {
logger.warn("Username not specified, notifying user that it's a required field.");
alertManager.alert(Duration.TRANSIENT, Severity.ERROR,
messages.format("errors.required", messages.get("user.username")));
return Login.class;
}/*www . j av a2 s . co m*/
// Expect username is the first item in the context
int userIdx = 0;
this.username = ctx.get(String.class, userIdx).trim();
logger.debug("Sending recovery token for username: " + username);
try {
userManager.sendPasswordRecoveryEmail(username, RequestUtil.getAppURL(request) + getLink());
} catch (final UsernameNotFoundException ignored) {
// lets ignore this
Throwable exceptionToLog = ignored.getCause() != null ? ignored.getCause() : ignored;
logger.error(exceptionToLog.getLocalizedMessage());
}
alertManager.alert(Duration.TRANSIENT, Severity.INFO, messages.get("updatePassword.recoveryToken.sent"));
return Login.class;
}