[gnome-system-tools] Fix setting password from random entry
- From: Milan Bouchet-Valat <milanbv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-system-tools] Fix setting password from random entry
- Date: Fri, 17 Dec 2010 18:53:59 +0000 (UTC)
commit adbfff7a78a1976de90d3781b37dcc9a63879240
Author: Milan Bouchet-Valat <nalimilan club fr>
Date: Fri Dec 17 16:44:16 2010 +0100
Fix setting password from random entry
The finish_password_change() function was checking the value of the
manual password entry, and thus considered no password was provided
when the random value was chosen. Just pass a boolean indicating
whether the password is set, and let caller functions decide from
the actual chosen password.
src/users/user-password.c | 12 +++++-------
1 files changed, 5 insertions(+), 7 deletions(-)
---
diff --git a/src/users/user-password.c b/src/users/user-password.c
index 89d06d6..fe6a9bc 100644
--- a/src/users/user-password.c
+++ b/src/users/user-password.c
@@ -323,10 +323,9 @@ on_edit_user_passwd (GtkButton *button,
* to the password-less option should be committed, and close dialog.
*/
static void
-finish_password_change ()
+finish_password_change (gboolean passwd_provided)
{
GtkWidget *user_passwd_dialog;
- GtkWidget *passwd_entry;
GtkWidget *nocheck_toggle;
OobsUser *user;
OobsGroup *no_passwd_login_group;
@@ -334,7 +333,6 @@ finish_password_change ()
gboolean is_self;
user_passwd_dialog = gst_dialog_get_widget (tool->main_dialog, "user_passwd_dialog");
- passwd_entry = gst_dialog_get_widget (tool->main_dialog, "user_settings_passwd1");
nocheck_toggle = gst_dialog_get_widget (tool->main_dialog, "user_passwd_no_check");
user = users_table_get_current ();
is_self = oobs_self_config_is_user_self (OOBS_SELF_CONFIG (GST_USERS_TOOL (tool)->self_config),
@@ -352,7 +350,7 @@ finish_password_change ()
* Else, we would believe the account is enabled, while it's not,
* and we would allow password-less login, which is unexpected. */
if (oobs_user_get_password_disabled (user)
- && strlen (gtk_entry_get_text (GTK_ENTRY (passwd_entry))) == 0)
+ && !passwd_provided)
{
/* Force removing user from this group, since results are unexpected */
if (no_passwd_login_group)
@@ -434,7 +432,7 @@ chpasswd_cb (PasswdHandler *passwd_handler,
if (!error) {
- finish_password_change ();
+ finish_password_change (TRUE);
passwd_destroy (passwd_handler);
return;
@@ -539,7 +537,7 @@ on_user_passwd_dialog_response (GtkDialog *user_passwd_dialog,
}
/* If empty, directly handle password-less option, don't change password */
else if (strlen (passwd) == 0) {
- finish_password_change ();
+ finish_password_change (FALSE);
g_object_unref (user);
return;
}
@@ -564,7 +562,7 @@ on_user_passwd_dialog_response (GtkDialog *user_passwd_dialog,
/* For other users, set password via the backends */
else {
oobs_user_set_password (user, passwd);
- finish_password_change ();
+ finish_password_change (TRUE);
}
g_object_unref (user);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]