LP1834969 Indicate failures in Angular login
authorBill Erickson <berickxx@gmail.com>
Wed, 3 Jul 2019 15:05:47 +0000 (11:05 -0400)
committerBill Erickson <berickxx@gmail.com>
Wed, 31 Jul 2019 19:55:59 +0000 (15:55 -0400)
Display a Login Failed message in the Angular staff login form when a
login attempt fails.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/eg2/src/app/staff/login.component.html
Open-ILS/src/eg2/src/app/staff/login.component.ts

index ba474f8..60bc630 100644 (file)
         </div>
 
         <div class="row">
-          <div class="col-lg-8 offset-lg-4 pl-0">
+          <div class="col-lg-2 offset-lg-4 pl-0">
             <button type="submit" class="btn btn-outline-dark" i18n>Sign in</button>
           </div>
+          <div class="col-lg-4" *ngIf="loginFailed">
+            <div class="badge badge-warning p-2" i18n>Login Failed</div>
+          </div>
         </div>
       </form>
     </fieldset>
index 2c1ac2a..de889f9 100644 (file)
@@ -11,6 +11,7 @@ import {StoreService} from '@eg/core/store.service';
 export class StaffLoginComponent implements OnInit {
 
     workstations: any[];
+    loginFailed: boolean;
 
     args = {
       username : '',
@@ -65,6 +66,7 @@ export class StaffLoginComponent implements OnInit {
 
         const workstation: string = this.args.workstation;
 
+        this.loginFailed = false;
         this.auth.login(this.args).then(
             ok => {
                 this.auth.redirectUrl = null;
@@ -86,7 +88,7 @@ export class StaffLoginComponent implements OnInit {
                 }
             },
             notOk => {
-                // indicate failure in the UI.
+                this.loginFailed = true;
             }
         );
     }