-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Last Login for admin manage your users #121
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here, it requires a comment that starts with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @bkcsoft There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @bkcsoft can be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @lunny now the ball is with you There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree with @andreynering, comment these should be another PR. |
||
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() | ||
} | ||
} | ||
|
||
|
Large diffs are not rendered by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment has to start with the function-name, e.g
// SetLastLogin sets the time of last login
. May sound stupid, butgo fmt
requires it 😒There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bkcsoft Okay, I will provide this