allow the logout method to be called via json.
This commit is contained in:
parent
9887f53654
commit
95f1b8f1ba
1 changed files with 7 additions and 1 deletions
|
@ -99,8 +99,14 @@ class Root(controllers.RootController):
|
|||
original_parameters=request.params,
|
||||
forward_url=forward_url)
|
||||
|
||||
@expose()
|
||||
@expose(allow_json=True)
|
||||
def logout(self):
|
||||
identity.current.logout()
|
||||
turbogears.flash(_('You have successfully logged out.'))
|
||||
if 'tg_format' in request.params \
|
||||
and request.params['tg_format'] == 'json':
|
||||
# When called as a json method, doesn't make any sense to
|
||||
# redirect to a page. Returning the logged in identity
|
||||
# is better.
|
||||
return dict(status=True)
|
||||
raise redirect(request.headers.get("Referer", "/"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue