public async Task <TwoFactorAuthenticatorResponseModel> GetAuthenticator([FromBody] TwoFactorRequestModel model)
        {
            var user = await CheckAsync(model.MasterPasswordHash, false);

            var response = new TwoFactorAuthenticatorResponseModel(user);

            return(response);
        }
Esempio n. 2
0
        public async Task <TwoFactorAuthenticatorResponseModel> GetAuthenticator([FromBody] SecretVerificationRequestModel model)
        {
            var user = await CheckAsync(model, false);

            var response = new TwoFactorAuthenticatorResponseModel(user);

            return(response);
        }
Esempio n. 3
0
        public async Task <TwoFactorAuthenticatorResponseModel> PutAuthenticator(
            [FromBody] UpdateTwoFactorAuthenticatorRequestModel model)
        {
            var user = await CheckAsync(model.MasterPasswordHash, false);

            model.ToUser(user);

            if (!await _userManager.VerifyTwoFactorTokenAsync(user, TwoFactorProviderType.Authenticator.ToString(), model.Token))
            {
                await Task.Delay(2000);

                throw new BadRequestException("Token", "Invalid token.");
            }

            await _userService.UpdateTwoFactorProviderAsync(user, TwoFactorProviderType.Authenticator);

            var response = new TwoFactorAuthenticatorResponseModel(user);

            return(response);
        }