This commit is contained in:
parent
4712a95909
commit
80b6e9dd0f
@ -17,7 +17,6 @@
|
||||
package integrations
|
||||
|
||||
import (
|
||||
"code.vikunja.io/api/pkg/files"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"net/url"
|
||||
@ -25,6 +24,8 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"code.vikunja.io/api/pkg/files"
|
||||
|
||||
"code.vikunja.io/api/pkg/config"
|
||||
"code.vikunja.io/api/pkg/db"
|
||||
"code.vikunja.io/api/pkg/events"
|
||||
|
@ -17,8 +17,9 @@
|
||||
package migration
|
||||
|
||||
import (
|
||||
"src.techknowlogick.com/xormigrate"
|
||||
"time"
|
||||
|
||||
"src.techknowlogick.com/xormigrate"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
|
@ -17,14 +17,16 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"code.vikunja.io/api/pkg/cron"
|
||||
"code.vikunja.io/api/pkg/db"
|
||||
"code.vikunja.io/api/pkg/log"
|
||||
"code.vikunja.io/api/pkg/utils"
|
||||
"time"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
// TokenKind represents a user token kind
|
||||
type TokenKind int
|
||||
|
||||
const (
|
||||
@ -35,6 +37,7 @@ const (
|
||||
tokenSize = 64
|
||||
)
|
||||
|
||||
// Token is a token a user can use to do things like verify their email or resetting their password
|
||||
type Token struct {
|
||||
ID int64 `xorm:"bigint autoincr not null unique pk"`
|
||||
UserID int64 `xorm:"not null"`
|
||||
@ -43,6 +46,7 @@ type Token struct {
|
||||
Created time.Time `xorm:"created not null"`
|
||||
}
|
||||
|
||||
// TableName returns the real table name for user tokens
|
||||
func (t *Token) TableName() string {
|
||||
return "user_tokens"
|
||||
}
|
||||
@ -75,6 +79,7 @@ func removeTokens(s *xorm.Session, u *User, kind TokenKind) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
// RegisterTokenCleanupCron registers a cron function to clean up all password reset tokens older than 24 hours
|
||||
func RegisterTokenCleanupCron() {
|
||||
const logPrefix = "[User Token Cleanup Cron] "
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user