Merge pull request #246 from CydarLtd/bootstrap_loading_spinner

Make first factor login page UI indicate loading state
pull/251/merge
Clément Michaud 2018-07-26 23:29:34 +02:00 committed by GitHub
commit 97e0ee8ff6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 3 deletions

View File

@ -1,3 +1,4 @@
export const USERNAME_FIELD_ID = "#username";
export const PASSWORD_FIELD_ID = "#password";
export const PASSWORD_FIELD_ID = "#password";
export const SIGN_IN_BUTTON_ID = "#signin";

View File

@ -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, $)
@ -28,7 +31,11 @@ export default function (window: Window, $: JQueryStatic,
}
function onFirstFactorFailure(err: Error) {
$("input,button").removeAttr("disabled");
$("form").css("opacity", 1);
notifier.error(UserMessages.AUTHENTICATION_FAILED);
$(UISelectors.PASSWORD_FIELD_ID).select();
$(UISelectors.SIGN_IN_BUTTON_ID).text("Sign in");
}
$(window.document).ready(function () {

View File

@ -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")

View File

@ -78,6 +78,10 @@ function CustomWorld() {
return that.driver.findElement(seleniumWebdriver.By.id("username"))
.sendKeys(username);
})
.then(function () {
return that.driver.findElement(seleniumWebdriver.By.id("password"))
.clear();
})
.then(function () {
return that.driver.findElement(seleniumWebdriver.By.id("password"))
.sendKeys(password);