diff --git a/client/src/css/01-main.css b/client/src/css/01-main.css index 0ed7ac73..e7db6aa1 100644 --- a/client/src/css/01-main.css +++ b/client/src/css/01-main.css @@ -63,4 +63,4 @@ body { } h1 { font-size: 25px; -} \ No newline at end of file +} diff --git a/client/src/lib/firstfactor/UISelectors.ts b/client/src/lib/firstfactor/UISelectors.ts index 25dc81ff..07591b4d 100644 --- a/client/src/lib/firstfactor/UISelectors.ts +++ b/client/src/lib/firstfactor/UISelectors.ts @@ -1,3 +1,4 @@ export const USERNAME_FIELD_ID = "#username"; -export const PASSWORD_FIELD_ID = "#password"; \ No newline at end of file +export const PASSWORD_FIELD_ID = "#password"; +export const SIGN_IN_BUTTON_ID = "#signin"; diff --git a/client/src/lib/firstfactor/index.ts b/client/src/lib/firstfactor/index.ts index 93fa2d76..4cc84584 100644 --- a/client/src/lib/firstfactor/index.ts +++ b/client/src/lib/firstfactor/index.ts @@ -15,7 +15,10 @@ export default function (window: Window, $: JQueryStatic, function onFormSubmitted() { const username: string = $(UISelectors.USERNAME_FIELD_ID).val() as string; const password: string = $(UISelectors.PASSWORD_FIELD_ID).val() as string; - $(UISelectors.PASSWORD_FIELD_ID).val(""); + + $("form").css("opacity", 0.5); + $("input,button").attr("disabled", "true"); + $(UISelectors.SIGN_IN_BUTTON_ID).text("Please wait..."); const redirectUrl = QueryParametersRetriever.get(Constants.REDIRECT_QUERY_PARAM); firstFactorValidator.validate(username, password, redirectUrl, $) @@ -29,6 +32,10 @@ export default function (window: Window, $: JQueryStatic, function onFirstFactorFailure(err: Error) { notifier.error(UserMessages.AUTHENTICATION_FAILED); + $(UISelectors.PASSWORD_FIELD_ID).select(); + $("form").css("opacity", 1); + $("input,button").removeAttr("disabled"); + $(UISelectors.SIGN_IN_BUTTON_ID).text("Sign in"); } $(window.document).ready(function () { diff --git a/server/src/views/firstfactor.pug b/server/src/views/firstfactor.pug index 373d2f45..caa52530 100644 --- a/server/src/views/firstfactor.pug +++ b/server/src/views/firstfactor.pug @@ -14,7 +14,7 @@ block content div(class="form-inputs") input(type="text" class="form-control" id="username" placeholder="Username" required autofocus) input(type="password" class="form-control" id="password" placeholder="Password" required) - button(class="btn btn-lg btn-primary btn-block" type="submit") Sign in + button(id="signin" class="btn btn-lg btn-primary btn-block" type="submit") Sign in div(class="bottom-right-links pull-right") a(href=reset_password_request_endpoint, class="link forgot-password") Forgot password? span(class="clearfix")