diff --git a/src/views/account.js b/src/views/account.js
index e283eb7ee..616d346bb 100644
--- a/src/views/account.js
+++ b/src/views/account.js
@@ -28,6 +28,8 @@ angular.module('Application').controller('AccountController', ['$scope', 'Client
$scope.twoFactorAuthenticationEnableForm.$setUntouched();
$scope.twoFactorAuthenticationEnableForm.$setPristine();
+ $scope.twoFactorAuthenticationDisableForm.$setUntouched();
+ $scope.twoFactorAuthenticationDisableForm.$setPristine();
},
show: function () {
@@ -70,12 +72,16 @@ angular.module('Application').controller('AccountController', ['$scope', 'Client
disable: function () {
$scope.twoFactorAuthentication.busy = true;
- Client.disableTwoFactorAuthentication($scope.twoFactorAuthentication.totpToken, function (error) {
+ Client.disableTwoFactorAuthentication($scope.twoFactorAuthentication.password, function (error) {
$scope.twoFactorAuthentication.busy = false;
if (error) {
$scope.twoFactorAuthentication.error = error.message;
- console.error(error);
+
+ $scope.twoFactorAuthentication.password = '';
+ $scope.twoFactorAuthenticationDisableForm.password.$setPristine();
+ $('#twoFactorAuthenticationPasswordInput').focus();
+
return;
}
@@ -330,7 +336,7 @@ angular.module('Application').controller('AccountController', ['$scope', 'Client
});
// setup all the dialog focus handling
- ['passwordChangeModal', 'emailChangeModal', 'fallbackEmailChangeModal', 'displayNameChangeModal', 'twoFactorAuthenticationEnableModal'].forEach(function (id) {
+ ['passwordChangeModal', 'emailChangeModal', 'fallbackEmailChangeModal', 'displayNameChangeModal', 'twoFactorAuthenticationEnableModal', 'twoFactorAuthenticationDisableModal'].forEach(function (id) {
$('#' + id).on('shown.bs.modal', function () {
$(this).find("[autofocus]:first").focus();
});