/* ------------------------------------------------------------------------ */
+static void kim_credential_remember_prefs (kim_identity in_identity,
+ kim_options in_options)
+{
+ kim_error err = KIM_NO_ERROR;
+ kim_preferences prefs = NULL;
+ kim_boolean remember_identity = 0;
+ kim_boolean remember_options = 0;
+
+ err = kim_preferences_create (&prefs);
+
+ if (!err && in_options) {
+ err = kim_preferences_get_remember_options (prefs,
+ &remember_options);
+ }
+
+ if (!err && in_identity) {
+ err = kim_preferences_get_remember_client_identity (prefs,
+ &remember_identity);
+ }
+
+ if (!err && remember_options) {
+ err = kim_preferences_set_options (prefs, in_options);
+ }
+
+ if (!err && remember_identity) {
+ err = kim_preferences_set_client_identity (prefs, in_identity);
+
+ }
+
+ if (!err && (remember_options || remember_identity)) {
+ err = kim_preferences_synchronize (prefs);
+ }
+
+ kim_preferences_free (&prefs);
+
+ check_error (err);
+}
+
+/* ------------------------------------------------------------------------ */
+
kim_error kim_credential_create_new_with_password (kim_credential *out_credential,
kim_identity in_identity,
kim_options in_options,
/* new creds obtained or the user gave up */
done_with_credentials = 1;
+ /* remember identity and options if the user wanted to */
+ kim_credential_remember_prefs (identity, options);
+
} else {
/* new creds failed, report error to user */
kim_error terr = kim_ui_handle_kim_error (&context, identity,
kim_error fini_err = kim_ui_fini (&context);
if (!err) { err = check_error (fini_err); }
}
-
+
if (!err) {
*out_credential = credential;
credential = NULL;
}
- if (options != in_options ) { kim_options_free (&options); }
+ if (options != in_options) { kim_options_free (&options); }
kim_credential_free (&credential);
return check_error (err);
if (!err && !in_preferences) { err = check_error (KIM_NULL_PARAMETER_ERR); }
- if (!err && in_preferences->remember_options && in_preferences->options_changed) {
+ if (!err && in_preferences->options_changed) {
err = kim_os_preferences_set_options_for_key (kim_preference_key_options,
in_preferences->options);
}
in_preferences->remember_options);
}
- if (!err && in_preferences->remember_client_identity && in_preferences->client_identity_changed) {
+ if (!err && in_preferences->client_identity_changed) {
kim_identity default_identity = kim_default_client_identity;
err = kim_os_identity_create_for_username (&default_identity);