Force relogin after server restart

- Mark all users with force_relogin during startup
- Ensure existing clients are returned to the login screen after a server update or restart

Signed-off-by: Sean Du <do4suki@gmail.com>
This commit is contained in:
2026-06-13 11:33:23 +08:00
parent 4b2c005222
commit af63f242da
+9
View File
@@ -42,6 +42,7 @@ func CreateTables() {
MigrateUserPref()
MigrateUserAccessories()
MigrateUserLiveData()
ForceAllUsersRelogin()
}
func MigrateUserPref() {
@@ -69,6 +70,14 @@ func MigrateUserPref() {
}
}
func ForceAllUsersRelogin() {
if _, err := db.UserEng.Table(new(usermodel.UserPref)).
Cols("force_relogin").
Update(&usermodel.UserPref{ForceRelogin: true}); err != nil {
log.Fatalln("设置全员重新登录失败:", err.Error())
}
}
type accessoryOwningMapRow struct {
AccessoryOwningUserID int `xorm:"accessory_owning_user_id"`
AccessoryID int `xorm:"accessory_id"`