Ejemplo n.º 1
0
        public async Task <AjaxResult> Jwtoken([FromBody] LoginDto dto)
        {
            Check.NotNull(dto, nameof(dto));

            if (!ModelState.IsValid)
            {
                return(new AjaxResult("提交信息验证失败", AjaxResultType.Error));
            }
            //todo: 校验验证码
            dto.Ip        = HttpContext.GetClientIp();
            dto.UserAgent = Request.Headers["User-Agent"].FirstOrDefault();

            OperationResult <string> token = await _identityService.JwtLogin(dto);

            return(new AjaxResult("登录成功", AjaxResultType.Success, token));
        }