fix deactivate
This commit is contained in:
+10
-3
@@ -225,7 +225,7 @@ func UpdateProfile(ctx context.Context, f form.UpdateProfile) {
|
||||
ctx.SetInternalErrorFlash()
|
||||
} else if passwordChanged {
|
||||
// 密码修改成功且其余资料也保存成功:强制登出重登。
|
||||
// 顺序与 DeactivateProfileAction 保持一致:先 Flush 会话再写入 flash,随后跳登录页。
|
||||
// 先 Flush 清会话再写入 flash,保证提示能带到登录页显示。
|
||||
ctx.Session.Flush()
|
||||
ctx.SetSuccessFlash(i18n.T(ctx.Lang(), "profile.flash.passwordChanged"))
|
||||
ctx.Redirect("/login")
|
||||
@@ -431,6 +431,13 @@ func DeactivateProfile(ctx context.Context) {
|
||||
ctx.Success("user/deactivate")
|
||||
}
|
||||
|
||||
// DeactivatedProfile 账号停用成功页。停用后会话已被清空、无法再登录,
|
||||
// 故为公开页,用于明确告知用户「已停用」而不是把其丢回登录页。
|
||||
func DeactivatedProfile(ctx context.Context) {
|
||||
ctx.SetTitle(i18n.T(ctx.Lang(), "deactivated.title"))
|
||||
ctx.Success("user/deactivated")
|
||||
}
|
||||
|
||||
// ExportProfileJSON 以 JSON 格式全量导出账号数据(用户信息 + 提问/回答/追问 + 私聊消息),
|
||||
// 符合可携带权要求,供用户备份/迁移。
|
||||
func ExportProfileJSON(ctx context.Context) {
|
||||
@@ -594,6 +601,6 @@ func DeactivateProfileAction(ctx context.Context) {
|
||||
return
|
||||
}
|
||||
ctx.Session.Flush()
|
||||
ctx.SetSuccessFlash(i18n.T(ctx.Lang(), "admin.flash.deactivated"))
|
||||
ctx.Redirect("/login")
|
||||
// 跳独立成功页而非登录页:账号已停用、无法再登录,落在登录页易让用户误以为操作未生效。
|
||||
ctx.Redirect("/deactivated")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user