处理登录的链接添加User Agent
This commit is contained in:
parent
46ee4ddd6f
commit
68c499b160
2
api.go
2
api.go
|
@ -36,6 +36,8 @@ func (svr *Server) handleLogin(ctx *http.Context) (err error) {
|
||||||
if err = ctx.Bind(req); err != nil {
|
if err = ctx.Bind(req); err != nil {
|
||||||
return ctx.Error(http.ErrInvalidPayload, err.Error())
|
return ctx.Error(http.ErrInvalidPayload, err.Error())
|
||||||
}
|
}
|
||||||
|
req.RealIP = ctx.RealIp()
|
||||||
|
req.UserAgent = ctx.Request().Header.Get("User-Agent")
|
||||||
if tk, err = passport.Login(ctx.Context(), req); err != nil {
|
if tk, err = passport.Login(ctx.Context(), req); err != nil {
|
||||||
return ctx.Error(http.ErrPermissionDenied, err.Error())
|
return ctx.Error(http.ErrPermissionDenied, err.Error())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue