@@ -893,8 +893,7 @@ func LinkAccountPostRegister(ctx *context.Context, cpt *captcha.Captcha, form au
893
893
ctx .Redirect (setting .AppSubURL + "/user/login" )
894
894
}
895
895
896
- // SignOut sign out from login status
897
- func SignOut (ctx * context.Context ) {
896
+ func handleSignOut (ctx * context.Context ) {
898
897
ctx .Session .Delete ("uid" )
899
898
ctx .Session .Delete ("uname" )
900
899
ctx .Session .Delete ("socialId" )
@@ -904,6 +903,11 @@ func SignOut(ctx *context.Context) {
904
903
ctx .SetCookie (setting .CookieRememberName , "" , - 1 , setting .AppSubURL , "" , setting .SessionConfig .Secure , true )
905
904
ctx .SetCookie (setting .CSRFCookieName , "" , - 1 , setting .AppSubURL , "" , setting .SessionConfig .Secure , true )
906
905
ctx .SetCookie ("lang" , "" , - 1 , setting .AppSubURL , "" , setting .SessionConfig .Secure , true ) // Setting the lang cookie will trigger the middleware to reset the language ot previous state.
906
+ }
907
+
908
+ // SignOut sign out from login status
909
+ func SignOut (ctx * context.Context ) {
910
+ handleSignOut (ctx )
907
911
ctx .Redirect (setting .AppSubURL + "/" )
908
912
}
909
913
@@ -1178,6 +1182,8 @@ func ForgotPasswdPost(ctx *context.Context) {
1178
1182
func ResetPasswd (ctx * context.Context ) {
1179
1183
ctx .Data ["Title" ] = ctx .Tr ("auth.reset_password" )
1180
1184
1185
+ // TODO for security and convenience, show the username / email here
1186
+
1181
1187
code := ctx .Query ("code" )
1182
1188
if len (code ) == 0 {
1183
1189
ctx .Error (404 )
@@ -1222,6 +1228,10 @@ func ResetPasswdPost(ctx *context.Context) {
1222
1228
ctx .ServerError ("UpdateUser" , err )
1223
1229
return
1224
1230
}
1231
+
1232
+ // Just in case the user is signed in to another account
1233
+ handleSignOut (ctx )
1234
+
1225
1235
u .HashPassword (passwd )
1226
1236
u .MustChangePassword = false
1227
1237
if err := models .UpdateUserCols (u , "must_change_password" , "passwd" , "rands" , "salt" ); err != nil {
@@ -1230,6 +1240,9 @@ func ResetPasswdPost(ctx *context.Context) {
1230
1240
}
1231
1241
1232
1242
log .Trace ("User password reset: %s" , u .Name )
1243
+
1244
+ // TODO change the former form to have password retype and remember me,
1245
+ // then sign in here instead of redirecting
1233
1246
ctx .Redirect (setting .AppSubURL + "/user/login" )
1234
1247
return
1235
1248
}
0 commit comments