Improve record's User field.

This commit is contained in:
Gucheng Wang 2021-11-07 17:20:15 +08:00
parent 77fffcacac
commit 5ec678fa28
3 changed files with 6 additions and 6 deletions

View File

@ -197,7 +197,7 @@ func (c *ApiController) Login() {
record := object.NewRecord(c.Ctx)
record.Organization = application.Organization
record.Username = user.Name
record.User = user.Name
object.AddRecord(record)
}
} else if form.Provider != "" {
@ -261,7 +261,7 @@ func (c *ApiController) Login() {
record := object.NewRecord(c.Ctx)
record.Organization = application.Organization
record.Username = user.Name
record.User = user.Name
object.AddRecord(record)
} else {
// Sign up via OAuth
@ -306,7 +306,7 @@ func (c *ApiController) Login() {
record := object.NewRecord(c.Ctx)
record.Organization = application.Organization
record.Username = user.Name
record.User = user.Name
object.AddRecord(record)
}
//resp = &Response{Status: "ok", Msg: "", Data: res}

View File

@ -27,7 +27,7 @@ type Record struct {
ClientIp string `xorm:"varchar(100)" json:"clientIp"`
Timestamp string `xorm:"varchar(100)" json:"timestamp"`
Organization string `xorm:"varchar(100)" json:"organization"`
Username string `xorm:"varchar(100)" json:"username"`
User string `xorm:"varchar(100)" json:"user"`
RequestUri string `xorm:"varchar(1000)" json:"requestUri"`
Action string `xorm:"varchar(1000)" json:"action"`
}
@ -40,7 +40,7 @@ func NewRecord(ctx *context.Context) *Record {
ClientIp: ip,
Timestamp: util.GetCurrentTime(),
RequestUri: ctx.Request.RequestURI,
Username: "",
User: "",
Organization: "",
Action: action,
}

View File

@ -62,7 +62,7 @@ func RecordMessage(ctx *context.Context) {
userId := getUser(ctx)
if userId != "" {
record.Organization, record.Username = util.GetOwnerAndNameFromId(userId)
record.Organization, record.User = util.GetOwnerAndNameFromId(userId)
}
object.AddRecord(record)