Hardcode ott-username input name in DefaultLoginPageGeneratingFilter

- GenerateOneTimeTokenFilter uses `"username"`, the default UI should use the same parameter name
This commit is contained in:
Daniel Garnier-Moiroux 2024-09-05 14:07:55 +02:00 committed by Marcus Hert Da Coregio
parent c0a10b90ba
commit 33495441b5
2 changed files with 3 additions and 3 deletions

View File

@ -242,8 +242,8 @@ public class DefaultLoginPageGeneratingFilter extends GenericFilterBean {
sb.append(" <h2>Request a One-Time Token</h2>\n"); sb.append(" <h2>Request a One-Time Token</h2>\n");
sb.append(createError(loginError, errorMsg) + createLogoutSuccess(logoutSuccess) + "<p>\n"); sb.append(createError(loginError, errorMsg) + createLogoutSuccess(logoutSuccess) + "<p>\n");
sb.append(" <label for=\"ott-username\" class=\"screenreader\">Username</label>\n"); sb.append(" <label for=\"ott-username\" class=\"screenreader\">Username</label>\n");
sb.append(" <input type=\"text\" id=\"ott-username\" name=\"" + this.usernameParameter sb.append(
+ "\" placeholder=\"Username\" required>\n"); " <input type=\"text\" id=\"ott-username\" name=\"username\" placeholder=\"Username\" required>\n");
sb.append(" </p>\n"); sb.append(" </p>\n");
sb.append(renderHiddenInputs(request)); sb.append(renderHiddenInputs(request));
sb.append(" <button class=\"primary\" type=\"submit\" form=\"ott-form\">Send Token</button>\n"); sb.append(" <button class=\"primary\" type=\"submit\" form=\"ott-form\">Send Token</button>\n");

View File

@ -199,7 +199,7 @@ public class DefaultLoginPageGeneratingFilterTests {
<h2>Request a One-Time Token</h2> <h2>Request a One-Time Token</h2>
<p> <p>
<label for="ott-username" class="screenreader">Username</label> <label for="ott-username" class="screenreader">Username</label>
<input type="text" id="ott-username" name="null" placeholder="Username" required> <input type="text" id="ott-username" name="username" placeholder="Username" required>
</p> </p>
<button class="primary" type="submit" form="ott-form">Send Token</button> <button class="primary" type="submit" form="ott-form">Send Token</button>
</form> </form>