Commit 69dc476c authored by Cédric Bellegarde's avatar Cédric Bellegarde

Show user message about Unverified account

parent 704babaa
Pipeline #76242 passed with stage
in 11 minutes and 15 seconds
......@@ -98,20 +98,26 @@ class SyncWorker:
self.__username = attributes["login"]
self.__password = password
# Connect to firefox sync
session = self.__firefox_sync.login(
self.__username, password, code)
bid_assertion, key = self.__firefox_sync.\
get_browserid_assertion(session)
self.__token = session.token
self.__uid = session.uid
self.__keyB = session.keys[1]
keyB_encoded = b64encode(self.__keyB).decode("utf-8")
record = {"uid": self.__uid,
"token": self.__token,
"keyB": keyB_encoded}
self.__helper.clear_sync(self.__helper.store_sync,
self.__username,
json.dumps(record))
try:
session = self.__firefox_sync.login(
self.__username, password, code)
bid_assertion, key = self.__firefox_sync.\
get_browserid_assertion(session)
self.__token = session.token
self.__uid = session.uid
self.__keyB = session.keys[1]
keyB_encoded = b64encode(self.__keyB).decode("utf-8")
record = {"uid": self.__uid,
"token": self.__token,
"keyB": keyB_encoded}
self.__helper.clear_sync(self.__helper.store_sync,
self.__username,
json.dumps(record))
except Exception as e:
self.__helper.clear_sync(self.__helper.store_sync,
self.__username,
"")
raise(e)
def new_session(self):
"""
......
......@@ -556,10 +556,18 @@ class SettingsDialog:
except Exception as e:
Logger.error("SettingsDialog::__connect_firefox_sync(): %s", e)
GLib.idle_add(self.__sync_button.set_sensitive, True)
GLib.idle_add(self.__result_label.set_text, str(e))
GLib.idle_add(self.__result_image.set_from_icon_name,
"computer-fail-symbolic",
Gtk.IconSize.MENU)
if not code and str(e) == "Unverified account":
GLib.timeout_add(500, self.__settings_dialog.destroy)
self.__window.toolbar.end.show_sync_button()
GLib.idle_add(
App().active_window.toolbar.title.show_message,
_("You've received an email"
" to validate syncing"))
else:
GLib.idle_add(self.__result_label.set_text, str(e))
GLib.idle_add(self.__result_image.set_from_icon_name,
"computer-fail-symbolic",
Gtk.IconSize.MENU)
def __on_get_sync(self, attributes, password, uri, index, count):
"""
......
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