Merge branch 'master' into advanced-permissions-phase-1
Этот коммит содержится в:
@@ -71,6 +71,7 @@ type User struct {
|
||||
LastPictureUpdate int64 `json:"last_picture_update,omitempty"`
|
||||
FailedAttempts int `json:"failed_attempts,omitempty"`
|
||||
Locale string `json:"locale"`
|
||||
Timezone StringMap `json:"timezone"`
|
||||
MfaActive bool `json:"mfa_active,omitempty"`
|
||||
MfaSecret string `json:"mfa_secret,omitempty"`
|
||||
LastActivityAt int64 `db:"-" json:"last_activity_at,omitempty"`
|
||||
@@ -86,6 +87,7 @@ type UserPatch struct {
|
||||
Props StringMap `json:"props,omitempty"`
|
||||
NotifyProps StringMap `json:"notify_props,omitempty"`
|
||||
Locale *string `json:"locale"`
|
||||
Timezone StringMap `json:"timezone"`
|
||||
}
|
||||
|
||||
type UserAuth struct {
|
||||
@@ -208,6 +210,10 @@ func (u *User) PreSave() {
|
||||
u.SetDefaultNotifications()
|
||||
}
|
||||
|
||||
if u.Timezone == nil {
|
||||
u.Props = make(map[string]string)
|
||||
}
|
||||
|
||||
if len(u.Password) > 0 {
|
||||
u.Password = HashPassword(u.Password)
|
||||
}
|
||||
@@ -302,6 +308,10 @@ func (u *User) Patch(patch *UserPatch) {
|
||||
if patch.Locale != nil {
|
||||
u.Locale = *patch.Locale
|
||||
}
|
||||
|
||||
if patch.Timezone != nil {
|
||||
u.Timezone = patch.Timezone
|
||||
}
|
||||
}
|
||||
|
||||
// ToJson convert a User to a json string
|
||||
|
||||
Ссылка в новой задаче
Block a user