Improve error reporting in demo mode

This commit is contained in:
Johannes Zellner
2022-04-27 14:09:07 +02:00
parent 74de921b00
commit db185c9146
5 changed files with 17 additions and 5 deletions
+4 -1
View File
@@ -28,6 +28,7 @@ angular.module('Application').controller('ProfileController', ['$scope', '$trans
$scope.twoFactorAuthentication = {
busy: false,
error: null,
notSupportedError: null,
password: '',
totpToken: '',
secret: '',
@@ -38,6 +39,7 @@ angular.module('Application').controller('ProfileController', ['$scope', '$trans
reset: function () {
$scope.twoFactorAuthentication.busy = false;
$scope.twoFactorAuthentication.error = null;
$scope.twoFactorAuthentication.notSupportedError = null;
$scope.twoFactorAuthentication.password = '';
$scope.twoFactorAuthentication.totpToken = '';
$scope.twoFactorAuthentication.secret = '';
@@ -54,7 +56,8 @@ angular.module('Application').controller('ProfileController', ['$scope', '$trans
$scope.twoFactorAuthentication.mandatory2FAHelp = false;
Client.setTwoFactorAuthenticationSecret(function (error, result) {
if (error) return console.error(error);
if (error && error.statusCode === 400) return $scope.twoFactorAuthentication.notSupportedError = error.message;
else if (error) return console.error(error);
$scope.twoFactorAuthentication.secret = result.secret;
$scope.twoFactorAuthentication.qrcode = result.qrcode;