Remove developer mode settings from account view

This commit is contained in:
Johannes Zellner
2015-04-23 12:26:29 +02:00
parent 77cbc15f01
commit d8f955b405
2 changed files with 1 additions and 98 deletions
-54
View File
@@ -89,40 +89,6 @@
</div>
</div>
<!-- Modal developer mode -->
<div class="modal fade" id="developerModeChangeModal" tabindex="-1" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" ng-hide="config.developerMode">Enable Developer Mode</h4>
<h4 class="modal-title" ng-show="config.developerMode">Disable Developer Mode</h4>
</div>
<div class="modal-body">
<form name="developerModeChangeForm" class="form-signin" role="form" novalidate ng-submit="doChangeDeveloperMode(developerModeChangeForm)" autocomplete="off">
<fieldset>
<div class="form-group" ng-class="{ 'has-error': (developerModeChangeForm.password.$dirty && developerModeChangeForm.password.$invalid)}">
<label class="control-label" for="inputDeveloperModeChangePassword">Give your password to verify that you are performing that action</label>
<div class="control-label" ng-show="(!developerModeChangeForm.password.$dirty && developerModeChange.error.password) || (developerModeChangeForm.password.$dirty && developerModeChangeForm.password.$invalid)">
<small ng-show="developerModeChangeForm.password.$error.required">A password is required</small>
<small ng-show="developerModeChangeForm.password.$error.minlength">The password is too short</small>
<small ng-show="developerModeChangeForm.password.$error.maxlength">The password is too long</small>
<small ng-show="developerModeChangeForm.password.$dirty && developerModeChange.error.password">Invalid pasword</small>
</div>
<input type="password" class="form-control" ng-model="developerModeChange.password" id="inputDeveloperModeChangePassword" name="password" ng-maxlength="512" ng-minlength="5" required autofocus>
</div>
<input class="ng-hide" type="submit" ng-disabled="developerModeChangeForm.$invalid"/>
</fieldset>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-danger" ng-hide="config.developerMode" ng-click="doChangeDeveloperMode(developerModeChangeForm)" ng-disabled="developerModeChangeForm.$invalid || developerModeChange.busy"><i class="fa fa-spinner fa-pulse" ng-show="developerModeChange.busy"></i> Enable</button>
<button type="button" class="btn btn-success" ng-show="config.developerMode" ng-click="doChangeDeveloperMode(developerModeChangeForm)" ng-disabled="developerModeChangeForm.$invalid || developerModeChange.busy"><i class="fa fa-spinner fa-pulse" ng-show="developerModeChange.busy"></i> Disable</button>
</div>
</div>
</div>
</div>
<div style="max-width: 600px; margin: 0 auto;">
<div class="text-left">
<h1>Account</h1>
@@ -193,23 +159,3 @@
</div>
</div>
</div>
<div style="max-width: 600px; margin: 0 auto;" ng-show="user.admin">
<div class="text-left">
<h3>Advanced</h3>
</div>
</div>
<div class="card" style="margin-bottom: 15px;" ng-show="user.admin">
<div class="grid-item-top">
<div class="row">
<div class="col-xs-6">
Developer Mode
</div>
<div class="col-xs-6 text-right">
<a href="" class="text-danger" ng-show="config.developerMode" ng-click="showChangeDeveloperMode()">Enabled</a>
<a href="" ng-hide="config.developerMode" ng-click="showChangeDeveloperMode()">Disabled</a>
</div>
</div>
</div>
</div>
+1 -44
View File
@@ -22,12 +22,6 @@ angular.module('Application').controller('AccountController', ['$scope', '$locat
password: ''
};
$scope.developerModeChange = {
busy: false,
error: {},
password: ''
};
function passwordChangeReset (form) {
$scope.passwordchange.error.password = null;
$scope.passwordchange.error.newPassword = null;
@@ -54,14 +48,6 @@ angular.module('Application').controller('AccountController', ['$scope', '$locat
}
}
function developerModeChangeReset () {
$scope.developerModeChange.error.password = null;
$scope.developerModeChange.password = '';
$scope.developerModeChangeForm.$setPristine();
$scope.developerModeChangeForm.$setUntouched();
}
$scope.doChangePassword = function (form) {
$scope.passwordchange.error.password = null;
$scope.passwordchange.error.newPassword = null;
@@ -114,29 +100,6 @@ angular.module('Application').controller('AccountController', ['$scope', '$locat
});
};
$scope.doChangeDeveloperMode = function () {
$scope.developerModeChange.error.password = null;
$scope.developerModeChange.busy = true;
Client.changeDeveloperMode(!$scope.config.developerMode, $scope.developerModeChange.password, function (error) {
if (error) {
if (error.statusCode === 403) {
$scope.developerModeChange.error.password = true;
$scope.developerModeChange.password = '';
$('#inputDeveloperModeChangePassword').focus();
} else {
console.error('Unable to change password.', error);
}
} else {
developerModeChangeReset();
$('#developerModeChangeModal').modal('hide');
}
$scope.developerModeChange.busy = false;
});
};
$scope.showChangePassword = function (form) {
passwordChangeReset(form);
@@ -149,12 +112,6 @@ angular.module('Application').controller('AccountController', ['$scope', '$locat
$('#emailChangeModal').modal('show');
};
$scope.showChangeDeveloperMode = function () {
developerModeChangeReset();
$('#developerModeChangeModal').modal('show');
};
$scope.removeAccessTokens = function (client) {
client.busy = true;
@@ -183,7 +140,7 @@ angular.module('Application').controller('AccountController', ['$scope', '$locat
});
// setup all the dialog focus handling
['passwordChangeModal', 'emailChangeModal', 'developerModeChangeModal'].forEach(function (id) {
['passwordChangeModal', 'emailChangeModal'].forEach(function (id) {
$('#' + id).on('shown.bs.modal', function () {
$(this).find("[autofocus]:first").focus();
});