Commit 90d3015c authored by Marcus Lundblad's avatar Marcus Lundblad
Browse files

osmAccountDialog, osmConnection: Show error message when store failed

Show error message when secret store fails.
parent 3d8f4d06
Pipeline #281039 passed with stage
in 13 minutes and 15 seconds
......@@ -25,6 +25,7 @@ const Gtk = imports.gi.Gtk;
const WebKit2 = imports.gi.WebKit2;
const Application = imports.application;
const Utils = imports.utils;
var Response = {
SIGNED_IN: 0
......@@ -181,7 +182,7 @@ var OSMAccountDialog = GObject.registerClass({
this._performVerification();
}
_onOAuthAccessTokenRequested(success) {
_onOAuthAccessTokenRequested(success, errorMessage) {
if (success) {
/* update the username label */
this._signedInUserLabel.label = Application.osmEdit.username;
......@@ -197,6 +198,8 @@ var OSMAccountDialog = GObject.registerClass({
this._stack.visible_child_name = 'logged-in';
}
} else {
if (errorMessage)
Utils.showDialog(errorMessage, Gtk.MessageType.ERROR, this);
/* switch back to the sign-in view, and show a label indicating
that verification failed */
this._resetPasswordLabel.visible = false;
......
......@@ -364,9 +364,15 @@ var OSMConnection = class OSMConnection {
_onPasswordStored(result, callback) {
let res = false;
if (result)
res = Secret.password_store_finish(result);
callback(res);
let errorMessage;
if (result) {
try {
res = Secret.password_store_finish(result);
} catch (error) {
errorMessage = error.message;
}
}
callback(res, errorMessage);
}
signOut() {
......
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