Пример #1
0
        public async Task <object> Login([FromBody] LoginDto model)
        {
            var result = await _signInManager.PasswordSignInAsync(model.Email, model.Password, false, false);

            if (result.Succeeded)
            {
                var appUser = _userManager.Users.SingleOrDefault(r => r.Email == model.Email);
                LoginSuccessViewModel success = _accountManager.GetAccountByEmail(model.Email);
                success.Token = _utils.GenerateJwtToken(model.Email, appUser, success.ImagePath, success.Role, success.Address, success.PhoneNumber);
                return(success);
            }
            else
            {
                return(Conflict("Invalid email or password!!!"));
            }
        }