Check if formData is empty before putting login hint (#20733)
closes keycloak#20732
This commit is contained in:
parent
0c2ac4f776
commit
ecf4dbfb18
1 changed files with 11 additions and 3 deletions
|
@ -586,11 +586,19 @@ public class FreeMarkerLoginFormsProvider implements LoginFormsProvider {
|
||||||
public Response createRegistration() {
|
public Response createRegistration() {
|
||||||
String loginHint = authenticationSession.getClientNote(OIDCLoginProtocol.LOGIN_HINT_PARAM);
|
String loginHint = authenticationSession.getClientNote(OIDCLoginProtocol.LOGIN_HINT_PARAM);
|
||||||
if (loginHint != null && !loginHint.isEmpty()) {
|
if (loginHint != null && !loginHint.isEmpty()) {
|
||||||
this.formData = new MultivaluedHashMap<>();
|
if (this.formData == null) {
|
||||||
|
this.formData = new MultivaluedHashMap<>();
|
||||||
|
}
|
||||||
if(this.realm.isRegistrationEmailAsUsername()) {
|
if(this.realm.isRegistrationEmailAsUsername()) {
|
||||||
this.formData.putSingle("email", loginHint);
|
String value = this.formData.getFirst("email");
|
||||||
|
if (value == null || value.trim().isEmpty()) {
|
||||||
|
this.formData.putSingle("email", loginHint);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.formData.putSingle("username", loginHint);
|
String value = this.formData.getFirst("username");
|
||||||
|
if (value == null || value.trim().isEmpty()) {
|
||||||
|
this.formData.putSingle("username", loginHint);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue