Beispiel #1
0
        public async Task <IActionResult> Login(LoginRequestDto request)
        {
            var studentByIndex = await studentDbService.GetByIndex(request.Login);

            if (studentByIndex == null)
            {
                return(StatusCode(StatusCodes.Status403Forbidden));
            }

            if (!PasswordHashHelper.Validate(studentByIndex.Password, studentByIndex.Salt, request.Password))
            {
                return(StatusCode(StatusCodes.Status403Forbidden));
            }

            var token = await accountService.GenerateAccessToken(studentByIndex);

            return(Ok(token));
        }