Commit a7533bf3 authored by Stavros Sachtouris's avatar Stavros Sachtouris
Browse files

Recover old token in case of authentication error

parent 9e0a1a4c
......@@ -86,7 +86,13 @@ class user_authenticate(_user_init, _optional_json):
@errors.user.authenticate
def _run(self, custom_token=None):
super(self.__class__, self)._run()
r = self.client.authenticate(custom_token)
token_bu = self.client.token
try:
r = self.client.authenticate(custom_token)
except Exception:
#recover old token
self.client.token = token_bu
raise
self._print(r, self._print_access)
def main(self, custom_token=None):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment