Skip to content
Permalink
Browse files

12-Dates-And-Times format lastseen

  • Loading branch information...
bonfy committed Oct 16, 2018
1 parent f90f32b commit 01611b3d27f6c78ca6c53878502f539695d1170b
Showing with 6 additions and 1 deletion.
  1. +5 −0 model/user.go
  2. +1 −1 templates/content/profile.html
@@ -138,6 +138,11 @@ func (u *User) GenerateToken() (string, error) {
return token.SignedString([]byte("secret"))
}

// FormattedLastSeen func
func (u *User) FormattedLastSeen() string {
return u.LastSeen.Format("2006-01-02 15:04:05")
}

// CheckToken func
func CheckToken(tokenString string) (string, error) {
token, err := jwt.Parse(tokenString, func(token *jwt.Token) (interface{}, error) {
@@ -10,7 +10,7 @@ <h1>User: {{.ProfileUser.Username}}</h1>
{{end}}

{{if .ProfileUser.LastSeen}}
<p>Last seen on: {{ .ProfileUser.LastSeen }}</p>
<p>Last seen on: {{ .ProfileUser.FormattedLastSeen }}</p>
{{end}}

<p>{{ .FollowersCount }} followers, {{ .FollowingCount }} following.</p>

0 comments on commit 01611b3

Please sign in to comment.
You can’t perform that action at this time.