Пример #1
0
        public UserTwoFactorSettings GetMySettings()
        {
            var userDetails = CustomDatabase.GetUserDetails(Security.GetUserId());

            var viewModel = new UserTwoFactorSettings()
            {
                IsSetup = userDetails != null && userDetails.IsValidated
            };

            return(viewModel);
        }
Пример #2
0
        public UserTwoFactorSettings RemoveTwoFactor()
        {
            var model   = new UserTwoFactorSettings();
            var userId  = Security.GetUserId();
            var details = CustomDatabase.GetUserDetails(userId);

            if (details == null || !details.IsValidated)
            {
                throw new UnauthorizedAccessException("This account hasnt got authenticator setup");
            }

            details.IsValidated = false;
            CustomDatabase.Update(details);

            return(model);
        }
        public GoogleAuthenticatorSettingsModel RemoveGoogleAuthenticatorForUser(int id)
        {
            CheckAuth();
            var model = new UserTwoFactorSettings();

            var details = CustomDatabase.GetUserDetails(id);

            if (details == null || !details.IsValidated)
            {
                throw new UnauthorizedAccessException("This account hasnt got authenticator setup");
            }

            details.IsValidated = false;
            CustomDatabase.Update(details);


            return(GetGoogleAuthenticatorSettings());
        }