openstax/accounts-rails

Need to logout of accounts when request is AJAX

jpslav opened this issue · 2 comments

When someone logs out of a product site, we have code to log that also logs them out of Accounts

https://github.com/openstax/accounts-rails/blob/master/app/controllers/openstax/accounts/sessions_controller.rb#L34-L38

This code works by redirecting to Account's logout action, which in turn redirects back to the root of the referrer:

https://github.com/openstax/accounts/blob/master/app/controllers/sessions_controller.rb#L35-L41

This is all fine for normal Rails views, but the redirect doesn't work for javascript requests. Can it be made to? (or do we need to require JS clients to send a non AJAX logout request?)

cc @Dantemss @philschatz

I think this can be solved by making the tutor logout be a GET like Phil wants for other reasons... I'll try it.

This was solved by allowing logout via GET