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

            var response = new TwoFactorEmailResponseModel(user);

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

            var response = new TwoFactorEmailResponseModel(user);

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

            model.ToUser(user);

            if (!await _userService.VerifyTwoFactorEmailAsync(user, model.Token))
            {
                await Task.Delay(2000);

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

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

            var response = new TwoFactorEmailResponseModel(user);

            return(response);
        }
Esempio n. 4
0
        public async Task <TwoFactorEmailResponseModel> PutEmail([FromBody] UpdateTwoFactorEmailRequestModel model)
        {
            var user = await CheckAsync(model, false);

            model.ToUser(user);

            if (!await _userManager.VerifyTwoFactorTokenAsync(user,
                                                              CoreHelpers.CustomProviderName(TwoFactorProviderType.Email), model.Token))
            {
                await Task.Delay(2000);

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

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

            var response = new TwoFactorEmailResponseModel(user);

            return(response);
        }