Skip to content

Commit

Permalink
#1303 Add MFA disable confirm in user settings page
Browse files Browse the repository at this point in the history
  • Loading branch information
nadouani committed May 2, 2020
1 parent 15c80dd commit 5187440
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions frontend/app/scripts/controllers/SettingsCtrl.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(function() {
'use strict';
angular.module('theHiveControllers').controller('SettingsCtrl',
function($scope, $state, UserSrv, AuthenticationSrv, NotificationSrv, clipboard, resizeService, readLocalPicService, currentUser, appConfig) {
function($scope, $state, UserSrv, ModalSrv, AuthenticationSrv, NotificationSrv, clipboard, resizeService, readLocalPicService, currentUser, appConfig) {
$scope.currentUser = currentUser;
$scope.appConfig = appConfig;

Expand Down Expand Up @@ -126,14 +126,26 @@
};

$scope.resetMfa = function() {
UserSrv.resetMfa()
.then(function(/*response*/) {
var modalInstance = ModalSrv.confirm(
'Disable MFA',
'Are you sure you want to disabble MFA settings?', {
okText: 'Yes, disable it',
flavor: 'danger'
}
);

modalInstance.result
.then(function() {
UserSrv.resetMfa();
})
.then(function() {
NotificationSrv.log('Your multi-factor authentication has been successfully disabled', 'success');
$state.reload();

})
.catch(function(err) {
NotificationSrv.error('SettingsCtrl', err.data, err.status);
if (!_.isString(err)) {
NotificationSrv.error('SettingsCtrl', err.data, err.status);
}
});
};

Expand Down

0 comments on commit 5187440

Please sign in to comment.