[gnome-control-center/gnome-3-8] user-accounts: avoid problems with automatic login



commit 2a981c0df021364723f94ee22a14ea4724f7460c
Author: Thomas Wood <thomas wood intel com>
Date:   Tue Jun 4 14:51:35 2013 +0100

    user-accounts: avoid problems with automatic login
    
    Prevent an account from being set to automatically logged in if it is
    disabled or requires the password to be changed at next login.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=701373

 panels/user-accounts/um-password-dialog.c |    2 ++
 panels/user-accounts/um-user-panel.c      |   19 +++++++++++++++----
 2 files changed, 17 insertions(+), 4 deletions(-)
---
diff --git a/panels/user-accounts/um-password-dialog.c b/panels/user-accounts/um-password-dialog.c
index f694456..014614c 100644
--- a/panels/user-accounts/um-password-dialog.c
+++ b/panels/user-accounts/um-password-dialog.c
@@ -253,6 +253,7 @@ accept_password_dialog (GtkButton        *button,
 
                 case UM_PASSWORD_DIALOG_MODE_SET_AT_LOGIN:
                         act_user_set_password_mode (um->user, ACT_USER_PASSWORD_MODE_SET_AT_LOGIN);
+                        act_user_set_automatic_login (um->user, FALSE);
                         break;
 
                 case UM_PASSWORD_DIALOG_MODE_NO_PASSWORD:
@@ -261,6 +262,7 @@ accept_password_dialog (GtkButton        *button,
 
                 case UM_PASSWORD_DIALOG_MODE_LOCK_ACCOUNT:
                         act_user_set_locked (um->user, TRUE);
+                        act_user_set_automatic_login (um->user, FALSE);
                         break;
 
                 case UM_PASSWORD_DIALOG_MODE_UNLOCK_ACCOUNT:
diff --git a/panels/user-accounts/um-user-panel.c b/panels/user-accounts/um-user-panel.c
index d29b359..980a99b 100644
--- a/panels/user-accounts/um-user-panel.c
+++ b/panels/user-accounts/um-user-panel.c
@@ -629,6 +629,18 @@ get_login_time_text (ActUser *user)
         return text;
 }
 
+static gboolean
+get_autologin_possible (ActUser *user)
+{
+        gboolean locked;
+        gboolean set_password_at_login;
+
+        locked = act_user_get_locked (user);
+        set_password_at_login = (act_user_get_password_mode (user) == ACT_USER_PASSWORD_MODE_SET_AT_LOGIN);
+
+        return !(locked || set_password_at_login);
+}
+
 static void
 show_user (ActUser *user, CcUserPanelPrivate *d)
 {
@@ -669,9 +681,7 @@ show_user (ActUser *user, CcUserPanelPrivate *d)
         g_signal_handlers_block_by_func (widget, autologin_changed, d);
         gtk_switch_set_active (GTK_SWITCH (widget), act_user_get_automatic_login (user));
         g_signal_handlers_unblock_by_func (widget, autologin_changed, d);
-
-        if (act_user_get_locked (user))
-                gtk_widget_set_sensitive (widget, FALSE);
+        gtk_widget_set_sensitive (widget, get_autologin_possible (user));
 
         widget = get_widget (d, "account-language-combo");
         model = um_editable_combo_get_model (UM_EDITABLE_COMBO (widget));
@@ -1102,7 +1112,8 @@ on_permission_changed (GPermission *permission,
         } else if (is_authorized && act_user_is_local_account (user)) {
                 um_editable_combo_set_editable (UM_EDITABLE_COMBO (get_widget (d, "account-type-combo")), 
TRUE);
                 remove_unlock_tooltip (get_widget (d, "account-type-combo"));
-                gtk_widget_set_sensitive (GTK_WIDGET (get_widget (d, "autologin-switch")), TRUE);
+
+                gtk_widget_set_sensitive (GTK_WIDGET (get_widget (d, "autologin-switch")), 
get_autologin_possible (user));
                 remove_unlock_tooltip (get_widget (d, "autologin-switch"));
         }
         else {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]