users: Don't ask for the old password when none is set

This prevents passwordless users (common on live cd setups) from
setting a password.

https://bugzilla.gnome.org/show_bug.cgi?id=684492
This commit is contained in:
Matthias Clasen 2012-09-22 14:08:29 -04:00
parent 752bfc47aa
commit a80b3d75c5

View file

@ -658,12 +658,10 @@ um_password_dialog_set_user (UmPasswordDialog *um,
gtk_entry_set_text (GTK_ENTRY (um->normal_hint_entry), "");
gtk_entry_set_text (GTK_ENTRY (um->old_password_entry), "");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (um->show_password_button), FALSE);
if (um_user_get_uid (um->user) == getuid()) {
if (um_user_get_uid (um->user) == getuid () &&
um_user_get_password_mode (um->user) == UM_PASSWORD_MODE_REGULAR) {
gtk_widget_show (um->old_password_label);
gtk_widget_show (um->old_password_entry);
if (um->passwd_handler != NULL)
passwd_destroy (um->passwd_handler);
um->passwd_handler = passwd_init ();
um->old_password_ok = FALSE;
}
else {
@ -671,6 +669,11 @@ um_password_dialog_set_user (UmPasswordDialog *um,
gtk_widget_hide (um->old_password_entry);
um->old_password_ok = TRUE;
}
if (um_user_get_uid (um->user) == getuid()) {
if (um->passwd_handler != NULL)
passwd_destroy (um->passwd_handler);
um->passwd_handler = passwd_init ();
}
}
model = gtk_combo_box_get_model (GTK_COMBO_BOX (um->action_combo));