From 43cd0bb654ae0225388678aa09798fc94be7a135 Mon Sep 17 00:00:00 2001 From: Simeon Simeonov Date: Fri, 9 Mar 2018 14:27:08 +0100 Subject: Fix some typos and tabify --- libsylph/masterpassword.c | 9 +++------ src/main.c | 8 +++++--- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/libsylph/masterpassword.c b/libsylph/masterpassword.c index 4cef644..d240a7a 100644 --- a/libsylph/masterpassword.c +++ b/libsylph/masterpassword.c @@ -140,15 +140,12 @@ gint check_master_password_interactively(guint max_attempts) { guint cnt; - if (max_attempts < 1) - return 1; - - if (prefs_common.master_password_hash != NULL) { - return 1; - } + g_return_val_if_fail(max_attempts > 0, 1); + g_return_val_if_fail(prefs_common.master_password_hash != NULL, 1); if (master_password != NULL) { /* password already cached */ + debug_print("Master password already cached\n"); return check_password(master_password, prefs_common.master_password_hash); } diff --git a/src/main.c b/src/main.c index 7c1cd7b..c6bd812 100644 --- a/src/main.c +++ b/src/main.c @@ -280,9 +280,9 @@ int main(int argc, char *argv[]) #if USE_SSL if (prefs_common.use_master_password) { if (prefs_common.master_password_hash != NULL) { - if (check_master_password_interactively(3)) { + if (check_master_password_interactively(3) != RC_OK) { if (alertpanel(_("Master password"), - _("Unable to set master password"), + _("Invalid master password"), GTK_STOCK_DISCARD, GTK_STOCK_QUIT, NULL) != G_ALERTDEFAULT) { @@ -290,7 +290,9 @@ int main(int argc, char *argv[]) } } } else { - if (set_master_password_interactively(3) != 0) { + alertpanel_notice( + _("Master password enabled but not set. Setting one now")); + if (set_master_password_interactively(3) != RC_OK) { if (alertpanel(_("Master password"), _("Unable to set master password"), GTK_STOCK_DISCARD, -- cgit v1.3