mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
recover from bad CSRF tokens without requiring a hard refresh of the browser
This commit is contained in:
@@ -22,7 +22,7 @@ class ApplicationController < ActionController::Base
|
||||
unless is_api?
|
||||
super
|
||||
clear_current_user
|
||||
raise Discourse::CSRF
|
||||
render text: "['BAD CSRF']", status: 403
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ class SessionController < ApplicationController
|
||||
end
|
||||
|
||||
def destroy
|
||||
session[:current_user_id] = nil
|
||||
reset_session
|
||||
cookies[:_t] = nil
|
||||
render nothing: true
|
||||
end
|
||||
|
||||
@@ -83,6 +83,8 @@ class Users::OmniauthCallbacksController < ApplicationController
|
||||
# log on any account that is active with forum access
|
||||
if Guardian.new(user).can_access_forum? && user.active
|
||||
log_on_user(user)
|
||||
# don't carry around old auth info, perhaps move elsewhere
|
||||
session[:authentication] = nil
|
||||
@data.authenticated = true
|
||||
else
|
||||
if SiteSetting.invite_only?
|
||||
|
||||
Reference in New Issue
Block a user