Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
augustinas committed Apr 19, 2018
2 parents 8bbaa2d + 8633c15 commit d811e03
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/app/user/login-native/login-native.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ <h3 class="title-hat-domain">{{ hatDomain }}</h3>
<label for="hatPass" hidden></label>
<input id="hatPass" type="password" class="hat-pass-input" name="hat-pass-input"
placeholder="Enter HAT password" #hatPass
(focus)="hideErrorMessage()"
(keyup.enter)="login(hatPass)"/>
<div *ngIf="passwordError" class="error alert alert-danger">
Incorrect password. Please try again.
</div>
</div>

<div>
Expand Down
7 changes: 6 additions & 1 deletion src/app/user/login-native/login-native.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export class LoginNativeComponent implements OnInit {
public hatName: string;
public hatDomain: string;
public rememberMe: boolean;
public passwordError = false;
public error: string;
private redirectPath: string;

Expand Down Expand Up @@ -63,6 +64,10 @@ export class LoginNativeComponent implements OnInit {
this.location.back();
}

hideErrorMessage(): void {
this.passwordError = false;
}

login(hatPass) {
this.storageSvc.rememberMe = this.rememberMe;
this.authSvc.login(this.hatName, hatPass.value).subscribe(
Expand All @@ -71,7 +76,7 @@ export class LoginNativeComponent implements OnInit {
},
err => {
console.log('Login failed! Reason: ', err);
this.error = 'Incorrect password. Please try again.';
this.passwordError = true;
});
}

Expand Down

0 comments on commit d811e03

Please sign in to comment.