Initial commit
This commit is contained in:
commit
c578b91c2d
46 files changed
+3241
No files matched your search
@@ -0,0 +1,31 @@
|
||||
package auth
|
||||
|
||||
import "time"
|
||||
|
||||
type Session struct {
|
||||
Token string
|
||||
UserId int64
|
||||
Device string
|
||||
Address string
|
||||
CreatedAt time.Time
|
||||
ExpiresAt time.Time
|
||||
}
|
||||
|
||||
type Invite struct {
|
||||
Token string
|
||||
Uses int64
|
||||
CreatedAt time.Time
|
||||
ExpiresAt time.Time
|
||||
}
|
||||
|
||||
func (s *Session) CreatedAtLocal() string {
|
||||
return s.CreatedAt.Local().Format("2006-01-02 15:04")
|
||||
}
|
||||
|
||||
func (s *Session) IsValid() bool {
|
||||
return time.Now().Before(s.ExpiresAt)
|
||||
}
|
||||
|
||||
func (i *Invite) IsValid() bool {
|
||||
return time.Now().Before(i.ExpiresAt) && i.Uses > 0
|
||||
}
|
||||
Reference in new issue
Block a user