Skip to content

Instantly share code, notes, and snippets.

@kylewelsby
Created April 30, 2013 10:48
Show Gist options
  • Save kylewelsby/5487962 to your computer and use it in GitHub Desktop.
Save kylewelsby/5487962 to your computer and use it in GitHub Desktop.
user session logout to send new CSRF token upon logout
def destroy
warden.authenticate!(:scope => resource_name, :recall => "#{controller_path}#failure")
current_user.update_column(:authentication_token, nil)
sign_out
render :status => 200,
:json => { :success => true,
:info => "Logged out",
:csrfParam => request_forgery_protection_token,
:csrfToken => form_authenticity_token
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment