Merge pull request #121 from joubertredrat/feature-last-login
Last Login for admin manage your users
This commit is contained in:
commit
1b238fe4d5
5 changed files with 64 additions and 40 deletions
|
@ -75,6 +75,8 @@ type User struct {
|
|||
CreatedUnix int64
|
||||
Updated time.Time `xorm:"-"`
|
||||
UpdatedUnix int64
|
||||
LastLogin time.Time `xorm:"-"`
|
||||
LastLoginUnix int64
|
||||
|
||||
// Remember visibility choice for convenience, true for private
|
||||
LastRepoVisibility bool
|
||||
|
@ -119,6 +121,11 @@ func (u *User) BeforeUpdate() {
|
|||
u.UpdatedUnix = time.Now().Unix()
|
||||
}
|
||||
|
||||
// Set time to last login
|
||||
func (u *User) SetLastLogin() {
|
||||
u.LastLoginUnix = time.Now().Unix()
|
||||
}
|
||||
|
||||
func (u *User) AfterSet(colName string, _ xorm.Cell) {
|
||||
switch colName {
|
||||
case "full_name":
|
||||
|
@ -127,6 +134,8 @@ func (u *User) AfterSet(colName string, _ xorm.Cell) {
|
|||
u.Created = time.Unix(u.CreatedUnix, 0).Local()
|
||||
case "updated_unix":
|
||||
u.Updated = time.Unix(u.UpdatedUnix, 0).Local()
|
||||
case "last_login_unix":
|
||||
u.LastLogin = time.Unix(u.LastLoginUnix, 0).Local()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue