mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-16 15:50:12 +02:00
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
26 lines
518 B
Go
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
|
|
}
|