Skip to content
This repository has been archived by the owner on May 22, 2019. It is now read-only.

Commit

Permalink
Dismiss login failed message when any key is pressed. Fixes #114
Browse files Browse the repository at this point in the history
  • Loading branch information
lots0logs committed Apr 17, 2017
1 parent 63ee17e commit 7c60cb4
Showing 1 changed file with 27 additions and 15 deletions.
42 changes: 27 additions & 15 deletions themes/default/js/greeter.js
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ class Theme {
this.tux = 'img/antergos-logo-user.png';
this.user_list_visible = false;
this.auth_pending = false;
this.showing_message = false;
this.selected_user = null;
this.$user_list = $( '#user-list2' );
this.$session_list = $( '#sessions' );
Expand Down Expand Up @@ -718,6 +719,7 @@ class Theme {

} else {
// The user did not enter the correct password. Show error message.
this.showing_message = true;
this.show_message( err_msg, 'error' );
}
}
Expand Down Expand Up @@ -748,21 +750,24 @@ class Theme {


key_press_handler( event ) {
let action;

switch ( event.which ) {
case 13:
action = this.auth_pending ? this.submit_password : ! this.user_list_visible ? this.show_user_list : null;
break;
case 27:
action = this.auth_pending ? this.cancel_authentication : null;
break;
case 32:
action = ( ! this.user_list_visible && ! this.auth_pending ) ? this.show_user_list : null;
break;
default:
action = null;
break;
let action = this.showing_message ? this.dismiss_message : null;

if ( null === action ) {
switch ( event.which ) {
case 13:
if ( this.auth_pending ) {
action = this.submit_password;
} else if ( ! this.user_list_visible ) {
action = this.show_user_list;
}
break;
case 27:
action = this.auth_pending ? this.cancel_authentication : null;
break;
case 32:
action = ( !this.user_list_visible && !this.auth_pending ) ? this.show_user_list : null;
break;
}
}

if ( null !== action ) {
Expand Down Expand Up @@ -853,6 +858,13 @@ class Theme {
$( '#collapseTwo .user-wrap2' ).hide();
this.$msg_area_container.show();
}

dismiss_message() {
this.$msg_area_container
.children( '.alert-dismissible' )
.find('.close')
.trigger('click');
}
}


Expand Down

0 comments on commit 7c60cb4

Please sign in to comment.