mirror of
https://github.com/lejianwen/rustdesk-api.git
synced 2025-12-02 18:13:15 +00:00
add DeviceId to userToken
This commit is contained in:
@@ -60,6 +60,7 @@ func (l *Login) Login(c *gin.Context) {
|
||||
ut := service.AllService.UserService.Login(u, &model.LoginLog{
|
||||
UserId: u.Id,
|
||||
Client: f.DeviceInfo.Type,
|
||||
DeviceId: f.Id,
|
||||
Uuid: f.Uuid,
|
||||
Ip: c.ClientIP(),
|
||||
Type: model.LoginLogTypeAccount,
|
||||
|
||||
@@ -94,6 +94,7 @@ func (o *Oauth) OidcAuthQueryPre(c *gin.Context) (*model.User, *model.UserToken)
|
||||
ut = service.AllService.UserService.Login(u, &model.LoginLog{
|
||||
UserId: u.Id,
|
||||
Client: v.DeviceType,
|
||||
DeviceId: v.Id,
|
||||
Uuid: v.Uuid,
|
||||
Ip: c.ClientIP(),
|
||||
Type: model.LoginLogTypeOauth,
|
||||
|
||||
@@ -4,6 +4,7 @@ type LoginLog struct {
|
||||
IdModel
|
||||
UserId uint `json:"user_id" gorm:"default:0;not null;"`
|
||||
Client string `json:"client"` //webadmin,webclient,app,
|
||||
DeviceId string `json:"device_id"`
|
||||
Uuid string `json:"uuid"`
|
||||
Ip string `json:"ip"`
|
||||
Type string `json:"type"` //account,oauth
|
||||
|
||||
@@ -3,7 +3,8 @@ package model
|
||||
type UserToken struct {
|
||||
IdModel
|
||||
UserId uint `json:"user_id" gorm:"default:0;not null;index"`
|
||||
DeviceUuid string `json:"device_uuid"`
|
||||
DeviceUuid string `json:"device_uuid" gorm:"default:'';omitempty;"`
|
||||
DeviceId string `json:"device_id" gorm:"default:'';omitempty;"`
|
||||
Token string `json:"token" gorm:"default:'';not null;index"`
|
||||
ExpiredAt int64 `json:"expired_at" gorm:"default:0;not null;"`
|
||||
TimeModel
|
||||
|
||||
@@ -76,6 +76,7 @@ func (us *UserService) Login(u *model.User, llog *model.LoginLog) *model.UserTok
|
||||
UserId: u.Id,
|
||||
Token: token,
|
||||
DeviceUuid: llog.Uuid,
|
||||
DeviceId: llog.DeviceId,
|
||||
ExpiredAt: time.Now().Add(time.Hour * 24 * 7).Unix(),
|
||||
}
|
||||
global.DB.Create(ut)
|
||||
|
||||
Reference in New Issue
Block a user