Files
gitea/modelmigration/v29/v358.go
T
wxiaoguang 2f1761e3fe fix(auth): avoid "compromised account" false-alarm when login with remember-me token (#39686)
1. Remember the last token that has been rotated and skip its validation
2. Don't alarm when the token mismatch occurs in a short window
2026-10-12 08:44:52 +00:00

26 lines
518 B
Go

// Copyright 2026 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package v29
import (
"context"
"gitea.dev/modelmigration/base"
"gitea.dev/modules/timeutil"
"xorm.io/xorm"
)
func AddPreviousAuthTokenHash(_ context.Context, x base.EngineMigration) error {
type AuthToken struct {
PreviousTokenHash string
RotatedUnix timeutil.TimeStamp
}
_, err := x.SyncWithOptions(xorm.SyncOptions{
IgnoreDropIndices: true,
IgnoreConstrains: true,
}, new(AuthToken))
return err
}