add oauth loginlog & fix bugs

This commit is contained in:
ljw
2024-09-19 10:44:49 +08:00
parent ebd1feb8d1
commit a4b413dadb
48 changed files with 3477 additions and 184 deletions

View File

@@ -3,4 +3,11 @@ package admin
type Login struct {
Username string `json:"username" validate:"required" label:"用户名"`
Password string `json:"password,omitempty" validate:"required" label:"密码"`
Platform string `json:"platform" label:"平台"`
}
type LoginLogQuery struct {
UserId int `form:"user_id"`
IsMy int `form:"is_my"`
PageQuery
}

View File

@@ -0,0 +1,34 @@
package admin
import "Gwen/model"
type BindOauthForm struct {
Op string `json:"op" binding:"required"`
}
type OauthConfirmForm struct {
Code string `json:"code" binding:"required"`
}
type UnBindOauthForm struct {
Op string `json:"op" binding:"required"`
}
type OauthForm struct {
Id uint `json:"id"`
Op string `json:"op" validate:"required"`
ClientId string `json:"client_id" validate:"required"`
ClientSecret string `json:"client_secret" validate:"required"`
RedirectUrl string `json:"redirect_url" validate:"required"`
AutoRegister *bool `json:"auto_register"`
}
func (of *OauthForm) ToOauth() *model.Oauth {
oa := &model.Oauth{
Op: of.Op,
ClientId: of.ClientId,
ClientSecret: of.ClientSecret,
RedirectUrl: of.RedirectUrl,
AutoRegister: of.AutoRegister,
}
oa.Id = of.Id
return oa
}

14
http/request/api/oauth.go Normal file
View File

@@ -0,0 +1,14 @@
package api
type OidcAuthRequest struct {
DeviceInfo DeviceInfoInLogin `json:"deviceInfo" label:"设备信息"`
Id string `json:"id" label:"id"`
Op string `json:"op" label:"op"`
Uuid string `json:"uuid" label:"uuid"`
}
type OidcAuthQuery struct {
Code string `json:"code" form:"code" label:"code"`
Id string `json:"id" form:"id" label:"id"`
Uuid string `json:"uuid" form:"uuid" label:"uuid"`
}

View File

@@ -21,9 +21,21 @@ package api
bytes hwid = 14;
}
*/
type DeviceInfoInLogin struct {
Name string `json:"name" label:"name"`
Os string `json:"os" label:"os"`
Type string `json:"type" label:"type"`
}
type LoginForm struct {
Username string `json:"username" validate:"required,gte=4,lte=10" label:"用户名"`
Password string `json:"password,omitempty" validate:"gte=4,lte=20" label:"密码"`
AutoLogin bool `json:"autoLogin" label:"自动登录"`
DeviceInfo DeviceInfoInLogin `json:"deviceInfo" label:"设备信息"`
Id string `json:"id" label:"id"`
Type string `json:"type" label:"type"`
Uuid string `json:"uuid" label:"uuid"`
Username string `json:"username" validate:"required,gte=4,lte=10" label:"用户名"`
Password string `json:"password,omitempty" validate:"gte=4,lte=20" label:"密码"`
}
type UserListQuery struct {