mirror of
https://github.com/evilsocket/arc.git
synced 2024-05-26 22:37:37 +03:00
fix: disabling login form while logging in
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -63,7 +63,7 @@
|
||||
<div ng-include src="'/views/modals/loader.html?v=7'"></div>
|
||||
|
||||
<!-- if user is not logged, show login -->
|
||||
<div id="login" class="container" ng-if="!arc.IsLogged()" ng-include src="'/views/login.html?v=4'"></div>
|
||||
<div id="login" class="container" ng-if="!arc.IsLogged()" ng-include src="'/views/login.html?v=5'"></div>
|
||||
|
||||
<!-- user logged but empty encryption key -->
|
||||
<div ng-if="arc.IsLogged() && !key" style="margin-bottom:-10px; margin-top:10px;" class="alert alert-warning">
|
||||
|
||||
@@ -228,6 +228,7 @@ app.controller('PMController', ['$scope', function (scope) {
|
||||
scope.errorHandler = function(error) {
|
||||
scope.hideLoader();
|
||||
scope.setError(error);
|
||||
scope.setLoginEnabled(true);
|
||||
scope.$apply();
|
||||
};
|
||||
|
||||
@@ -461,6 +462,13 @@ app.controller('PMController', ['$scope', function (scope) {
|
||||
}
|
||||
};
|
||||
|
||||
scope.setLoginEnabled = function(enabled) {
|
||||
$('#loginButton').text(enabled ? 'Login' : 'Logging in ...');
|
||||
$('#formLogin *').filter(':input').each(function(){
|
||||
$(this).prop('disabled', !enabled);
|
||||
});
|
||||
};
|
||||
|
||||
scope.doLogin = function() {
|
||||
scope.setStatus("Logging in ...");
|
||||
|
||||
@@ -468,7 +476,9 @@ app.controller('PMController', ['$scope', function (scope) {
|
||||
var username = $('#username').val();
|
||||
var password = $('#password').val();
|
||||
|
||||
if( scope.setKey( $('#key').val(), persist ) == true ) {
|
||||
if( scope.setKey( $('#key').val(), persist ) == true ) {
|
||||
scope.setLoginEnabled(false);
|
||||
|
||||
scope.arc.Login( username, password, persist, function(token) {
|
||||
scope.setError(null);
|
||||
scope.$apply();
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
<input type="checkbox" id="persist" value="persist"/> Remember me.
|
||||
</label>
|
||||
<br/>
|
||||
<button type="submit" class="btn btn-secondary float-right" ng-click="doLogin()">Login</button>
|
||||
<button type="submit" class="btn btn-secondary float-right" ng-click="doLogin()"
|
||||
id="loginButton">Login</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user