处理登录的链接添加User Agent

This commit is contained in:
fancl 2024-12-13 10:43:49 +08:00
parent 46ee4ddd6f
commit 68c499b160
1 changed files with 2 additions and 0 deletions

2
api.go
View File

@ -36,6 +36,8 @@ func (svr *Server) handleLogin(ctx *http.Context) (err error) {
if err = ctx.Bind(req); err != nil {
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 {
return ctx.Error(http.ErrPermissionDenied, err.Error())
}