예제 #1
0
        public async Task PostEmailToken([FromBody] EmailTokenRequestModel model)
        {
            if (!await _userManager.CheckPasswordAsync(_currentContext.User, model.MasterPasswordHash))
            {
                await Task.Delay(2000);

                throw new BadRequestException("MasterPasswordHash", "Invalid password.");
            }

            await _userService.InitiateEmailChangeAsync(_currentContext.User, model.NewEmail);
        }
예제 #2
0
        public async Task PostEmailToken([FromBody] EmailTokenRequestModel model)
        {
            var user = await _userService.GetUserByPrincipalAsync(User);

            if (!await _userManager.CheckPasswordAsync(user, model.MasterPasswordHash))
            {
                await Task.Delay(2000);

                throw new BadRequestException("MasterPasswordHash", "Invalid password.");
            }

            await _userService.InitiateEmailChangeAsync(user, model.NewEmail);
        }
예제 #3
0
        public async Task PostEmailToken([FromBody] EmailTokenRequestModel model)
        {
            var user = await _userService.GetUserByPrincipalAsync(User);

            if (user == null)
            {
                throw new UnauthorizedAccessException();
            }

            if (user.UsesKeyConnector)
            {
                throw new BadRequestException("You cannot change your email when using Key Connector.");
            }

            if (!await _userService.CheckPasswordAsync(user, model.MasterPasswordHash))
            {
                await Task.Delay(2000);

                throw new BadRequestException("MasterPasswordHash", "Invalid password.");
            }

            await _userService.InitiateEmailChangeAsync(user, model.NewEmail);
        }