Esempio n. 1
0
        public async Task <IActionResult> VerifyPasswordAsync([FromBody] VerifyPasswordDto data)
        {
            var result = await _userService.VerifyAsync(data);

            if (result == null)
            {
                return(NotFound());
            }
            return(Ok(result));
        }
        public async Task <TaskResult <ApplicationUser> > VerifyPassword(VerifyPasswordDto data)
        {
            var user = await GetUser(data.Email);

            var result = await PerformUserAction(user, () =>
                                                 userManager.Authenticate(user, data.Password), false);

            return(result
                ? new TaskResult <ApplicationUser>(user)
                : new TaskResult <ApplicationUser>(new[] { "Incorrect email or password" }));
        }
Esempio n. 3
0
        public async Task <ResultHandler> VerifyPassword(VerifyPasswordDto data)
        {
            var result = await repository.VerifyPassword(data);

            if (result.Success)
            {
                var mappedResult = new TaskResult <AuthenticateDto>(new AuthenticateDto
                {
                    Token    = GenerateJwt(data.Email),
                    UserData = mapper.Map <UserDataDto>(result.Payload)
                });

                return(ResultHandler.HandleTaskResult(mappedResult));
            }

            return(ResultHandler.HandleTaskResult(result));
        }
Esempio n. 4
0
        public async Task <bool> ValidatePass([FromBody] VerifyPasswordDto dto)
        {
            bool res = await UserService.OldPasswordExists(dto.Id, dto.OldPassword);

            return(res);
        }