mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 21:27:40 +00:00
GUACAMOLE-1756: Display login failures regardless of whether the interactive login form was used.
This commit is contained in:
committed by
Mike Jumper
parent
116edebf36
commit
a1fbe5f0a4
@@ -23,6 +23,9 @@
|
||||
angular.module('index').controller('indexController', ['$scope', '$injector',
|
||||
function indexController($scope, $injector) {
|
||||
|
||||
// Required types
|
||||
const Error = $injector.get('Error');
|
||||
|
||||
// Required services
|
||||
const $document = $injector.get('$document');
|
||||
const $location = $injector.get('$location');
|
||||
@@ -94,6 +97,11 @@ angular.module('index').controller('indexController', ['$scope', '$injector',
|
||||
*/
|
||||
var ApplicationState = {
|
||||
|
||||
/**
|
||||
* A non-interactive authentication attempt failed.
|
||||
*/
|
||||
AUTOMATIC_LOGIN_REJECTED : 'automaticLoginRejected',
|
||||
|
||||
/**
|
||||
* The application has fully loaded but is awaiting credentials from
|
||||
* the user before proceeding.
|
||||
@@ -265,6 +273,25 @@ angular.module('index').controller('indexController', ['$scope', '$injector',
|
||||
|
||||
});
|
||||
|
||||
// Alert user to authentication errors that occur in the absence of an
|
||||
// interactive login form
|
||||
$scope.$on('guacLoginFailed', function loginFailed(event, parameters, error) {
|
||||
|
||||
// All errors related to an interactive login form are handled elsewhere
|
||||
if ($scope.applicationState === ApplicationState.AWAITING_CREDENTIALS
|
||||
|| error.type === Error.Type.INSUFFICIENT_CREDENTIALS
|
||||
|| error.type === Error.Type.INVALID_CREDENTIALS)
|
||||
return;
|
||||
|
||||
$scope.applicationState = ApplicationState.AUTOMATIC_LOGIN_REJECTED;
|
||||
$scope.page.title = 'APP.NAME';
|
||||
$scope.page.bodyClassName = '';
|
||||
|
||||
$scope.reAuthenticating = false;
|
||||
$scope.fatalError = error;
|
||||
|
||||
});
|
||||
|
||||
// Replace absolutely all content with an error message if the page itself
|
||||
// cannot be displayed due to an error
|
||||
$scope.$on('guacFatalPageError', function fatalPageError(error) {
|
||||
|
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
.automatic-login-rejected-modal guac-modal {
|
||||
background: white;
|
||||
z-index: 20;
|
||||
}
|
||||
|
||||
.automatic-login-rejected-modal .notification {
|
||||
display: inline-block;
|
||||
max-width: 5in;
|
||||
padding: 1em;
|
||||
width: 100%;
|
||||
}
|
@@ -64,6 +64,20 @@
|
||||
</guac-modal>
|
||||
</div>
|
||||
|
||||
<!-- Authentication error without a corresponding login form -->
|
||||
<div class="automatic-login-rejected-modal" ng-switch-when="automaticLoginRejected">
|
||||
<guac-modal>
|
||||
<div class="notification">
|
||||
<p translate="{{ fatalError.translatableMessage.key }}"
|
||||
translate-values="{{ fatalError.translatableMessage.variables }}"></p>
|
||||
<p>
|
||||
<button translate="APP.ACTION_LOGIN_AGAIN" ng-disabled="reAuthenticating"
|
||||
ng-click="reAuthenticate()"></button>
|
||||
</p>
|
||||
</div>
|
||||
</guac-modal>
|
||||
</div>
|
||||
|
||||
<!-- Login screen for logged-out users -->
|
||||
<guac-login ng-switch-when="awaitingCredentials"
|
||||
help-text="loginHelpText"
|
||||
|
Reference in New Issue
Block a user