mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 21:27:40 +00:00
GUAC-1176: Use existing login error status. No need for modal notifications.
This commit is contained in:
@@ -73,29 +73,9 @@ angular.module('login').directive('guacLogin', [function guacLogin() {
|
|||||||
var authenticationService = $injector.get('authenticationService');
|
var authenticationService = $injector.get('authenticationService');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An action to be provided along with the object assigned to
|
* A description of the error that occurred during login, if any.
|
||||||
* $scope.loginStatus which closes the currently-shown status dialog.
|
|
||||||
*/
|
|
||||||
var ACKNOWLEDGE_ACTION = {
|
|
||||||
name : "LOGIN.ACTION_ACKNOWLEDGE",
|
|
||||||
// Handle action
|
|
||||||
callback : function acknowledgeCallback() {
|
|
||||||
$scope.loginStatus = false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The currently-visible notification describing login status, or false
|
|
||||||
* if no notification should be shown.
|
|
||||||
*
|
*
|
||||||
* @type Notification|Boolean|Object
|
* @type String
|
||||||
*/
|
|
||||||
$scope.loginStatus = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether an error occurred during login.
|
|
||||||
*
|
|
||||||
* @type Boolean
|
|
||||||
*/
|
*/
|
||||||
$scope.loginError = false;
|
$scope.loginError = false;
|
||||||
|
|
||||||
@@ -155,8 +135,7 @@ angular.module('login').directive('guacLogin', [function guacLogin() {
|
|||||||
$scope.login = function login() {
|
$scope.login = function login() {
|
||||||
|
|
||||||
// Start with cleared status
|
// Start with cleared status
|
||||||
$scope.loginError = false;
|
$scope.loginError = null;
|
||||||
$scope.loginStatus = false;
|
|
||||||
|
|
||||||
// Attempt login once existing session is destroyed
|
// Attempt login once existing session is destroyed
|
||||||
authenticationService.authenticate($scope.enteredValues)
|
authenticationService.authenticate($scope.enteredValues)
|
||||||
@@ -175,16 +154,11 @@ angular.module('login').directive('guacLogin', [function guacLogin() {
|
|||||||
|
|
||||||
// Flag generic error for invalid login
|
// Flag generic error for invalid login
|
||||||
if (error.type === Error.Type.INVALID_CREDENTIALS)
|
if (error.type === Error.Type.INVALID_CREDENTIALS)
|
||||||
$scope.loginError = true;
|
$scope.loginError = 'LOGIN.ERROR_INVALID_LOGIN';
|
||||||
|
|
||||||
// Display error if anything else goes wrong
|
// Display error if anything else goes wrong
|
||||||
else
|
else
|
||||||
$scope.loginStatus = {
|
$scope.loginError = error.message;
|
||||||
'className' : 'error',
|
|
||||||
'title' : 'LOGIN.DIALOG_HEADER_ERROR',
|
|
||||||
'text' : error.message,
|
|
||||||
'actions' : [ ACKNOWLEDGE_ACTION ]
|
|
||||||
};
|
|
||||||
|
|
||||||
// Clear all visible password fields
|
// Clear all visible password fields
|
||||||
angular.forEach($scope.remainingFields, function clearEnteredValueIfPassword(field) {
|
angular.forEach($scope.remainingFields, function clearEnteredValueIfPassword(field) {
|
||||||
|
@@ -22,7 +22,7 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<!-- Login error message -->
|
<!-- Login error message -->
|
||||||
<p class="login-error">{{'LOGIN.ERROR_INVALID_LOGIN' | translate}}</p>
|
<p class="login-error">{{loginError | translate}}</p>
|
||||||
|
|
||||||
<div class="login-dialog-middle">
|
<div class="login-dialog-middle">
|
||||||
|
|
||||||
@@ -54,11 +54,4 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Login-specific status/error dialog -->
|
|
||||||
<div ng-class="{shown: loginStatus}" class="status-outer">
|
|
||||||
<div class="status-middle">
|
|
||||||
<guac-notification notification="loginStatus"></guac-notification>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user