[gnome-initial-setup/shell/4765: 25/362] Unlock keyring on first login
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-initial-setup/shell/4765: 25/362] Unlock keyring on first login
- Date: Thu, 19 Mar 2015 01:23:09 +0000 (UTC)
commit 5284f2078a906170fafc78ad09889a7a5e9e38f9
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date: Tue Apr 22 18:28:27 2014 +0200
Unlock keyring on first login
Just after the first run of gnome-initial-setup, where a new user is
created, the system logins directly with the new user account.
In this step, unlock the keyring automatically.
This is done by saving temporarily the password in the
gnome-initial-setup step, and read it after the login.
[endlessm/eos-shell#2298]
configure.ac | 2 +-
.../gnome-initial-setup-copy-worker.c | 20 ++++++++++++++++++++
.../pages/account/gis-account-page.c | 11 +++++++++++
3 files changed, 32 insertions(+), 1 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index f834a60..47794c2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -55,7 +55,7 @@ PKG_CHECK_MODULES(INITIAL_SETUP,
pwquality
egg-list-box-uninstalled)
-PKG_CHECK_MODULES(COPY_WORKER, gio-2.0)
+PKG_CHECK_MODULES(COPY_WORKER, gio-2.0 gnome-keyring-1)
GEOCLUE_DBUS_INTERFACE_XML=`pkg-config --variable=dbus_interface geoclue-2.0`
if test "x$GEOCLUE_DBUS_INTERFACE_XML" = "x"; then
diff --git a/gnome-initial-setup/gnome-initial-setup-copy-worker.c
b/gnome-initial-setup/gnome-initial-setup-copy-worker.c
index cef2363..3b842ea 100644
--- a/gnome-initial-setup/gnome-initial-setup-copy-worker.c
+++ b/gnome-initial-setup/gnome-initial-setup-copy-worker.c
@@ -6,6 +6,7 @@
#include <pwd.h>
#include <string.h>
#include <gio/gio.h>
+#include <gnome-keyring.h>
#include <stdlib.h>
static char *
@@ -65,6 +66,23 @@ move_file_from_tmpfs (GFile *src_base,
}
}
+static void
+unlock_keyring (const gchar *initial_setup_homedir)
+{
+ gchar *file;
+ gchar *password = NULL;
+
+ file = g_build_filename (initial_setup_homedir, ".config/password", NULL);
+ if (g_file_get_contents (file, &password, NULL, NULL))
+ gnome_keyring_unlock_sync ("login", password);
+ else
+ g_warning ("Unable to read user password file");
+
+ g_remove (file);
+ g_free (file);
+ g_free (password);
+}
+
int
main (int argc,
char **argv)
@@ -95,6 +113,8 @@ main (int argc,
FILE (".config/goa-1.0/accounts.conf");
FILE (".local/share/keyrings/login.keyring");
+ unlock_keyring (initial_setup_homedir);
+
gis_done_file_path = g_build_filename (g_get_user_config_dir (),
"gnome-initial-setup-done",
NULL);
diff --git a/gnome-initial-setup/pages/account/gis-account-page.c
b/gnome-initial-setup/pages/account/gis-account-page.c
index 4e50380..2489d91 100644
--- a/gnome-initial-setup/pages/account/gis-account-page.c
+++ b/gnome-initial-setup/pages/account/gis-account-page.c
@@ -407,6 +407,16 @@ password_entry_focus_out (GtkWidget *widget,
return FALSE;
}
+static void
+save_user_password (const gchar *password)
+{
+ gchar *file;
+
+ file = g_build_filename (g_get_user_config_dir (), "password", NULL);
+ g_file_set_contents (file, password, -1, NULL);
+ g_free (file);
+}
+
static gboolean
confirm_entry_focus_out (GtkWidget *widget,
GdkEventFocus *event,
@@ -490,6 +500,7 @@ local_create_user (GisAccountPage *page)
} else {
act_user_set_password (priv->act_user, password, "");
gnome_keyring_create_sync ("login", password);
+ save_user_password (password);
}
language = gis_driver_get_user_language (GIS_PAGE (page)->driver);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]