NullPointerException on reading auth.attemptedUsername in terms template
closes #21294
This commit is contained in:
parent
b59faa51d5
commit
8cc04a6724
1 changed files with 4 additions and 0 deletions
|
@ -60,6 +60,10 @@ public class AuthenticationContextBean {
|
||||||
// NOTE: This is called "attemptedUsername" as we won't necessarily display the username of the user, but the "attempted username", which he
|
// NOTE: This is called "attemptedUsername" as we won't necessarily display the username of the user, but the "attempted username", which he
|
||||||
// used on the login screen (which could be eventually email or something else)
|
// used on the login screen (which could be eventually email or something else)
|
||||||
public String getAttemptedUsername() {
|
public String getAttemptedUsername() {
|
||||||
|
if (context == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
String username = context.getAuthenticationSession().getAuthNote(AbstractUsernameFormAuthenticator.ATTEMPTED_USERNAME);
|
String username = context.getAuthenticationSession().getAuthNote(AbstractUsernameFormAuthenticator.ATTEMPTED_USERNAME);
|
||||||
|
|
||||||
// Fallback to real username of the user just if attemptedUsername doesn't exist
|
// Fallback to real username of the user just if attemptedUsername doesn't exist
|
||||||
|
|
Loading…
Reference in a new issue