[enh] Return data at log in/out

This commit is contained in:
Jérôme Lebleu 2014-05-16 19:51:56 +02:00
parent 95d2e0c54f
commit acc7000977
3 changed files with 8 additions and 4 deletions

View file

@ -21,6 +21,8 @@
"authentication_profile_required" : "Authentication to profile '%s' required",
"operation_interrupted" : "Operation interrupted",
"logged_in" : "Logged in",
"logged_out" : "Logged out",
"not_logged_in" : "You are not logged in",
"server_already_running" : "A server is already running on that port"
}

View file

@ -21,6 +21,8 @@
"authentication_profile_required" : "Authentification au profile '%s' requise",
"operation_interrupted" : "Opération interrompue",
"logged_in" : "Connecté",
"logged_out" : "Déconnecté",
"not_logged_in" : "Vous n'êtes pas connecté",
"server_already_running" : "Un server est déjà en cours d'exécution sur ce port"
}

View file

@ -219,7 +219,7 @@ class _ActionsMapPlugin(object):
response.set_cookie('session.id', s_id, secure=True)
response.set_cookie('session.hashes', s_hashes, secure=True,
secret=s_secret)
raise HTTPOKResponse()
raise HTTPOKResponse(m18n.g('logged_in'))
def logout(self, profile=None):
"""Log out from an authenticator profile
@ -241,7 +241,7 @@ class _ActionsMapPlugin(object):
# Delete cookie and clean the session
response.set_cookie('session.hashes', '', max_age=-1)
clean_session(s_id)
raise HTTPOKResponse()
raise HTTPOKResponse(m18n.g('logged_out'))
def process(self, _route, arguments={}):
"""Process the relevant action for the route
@ -445,8 +445,8 @@ class Interface(BaseInterface):
app.install(_ActionsMapPlugin(actionsmap))
# Append default routes
app.route(['/api', '/api/<category:re:[a-z]+>'], method='GET',
callback=self.doc, skip=['actionsmap'])
# app.route(['/api', '/api/<category:re:[a-z]+>'], method='GET',
# callback=self.doc, skip=['actionsmap'])
# Append additional routes
# TODO: Add optional authentication to those routes?