2 * This file is part of signonui-efl
4 * Copyright (C) 2013 Intel Corporation.
6 * Author: Jussi Kukkonen <jussi.kukkonen@intel.com>
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
24 #include <Elementary.h>
26 #include <gsignond/gsignond-signonui-data.h>
28 #include "sso-ui-dialog.h"
30 FIXME : below defs should be remove once we revert
33 #ifndef gsignond_signonui_data_ref
34 # define gsignond_signonui_data_ref gsignond_dictionary_ref
36 #ifndef gsignond_signonui_data_unref
37 # define gsignond_signonui_data_unref gsignond_dictionary_unref
39 #ifndef gsignond_signonui_data_new
40 # define gsignond_signonui_data_new gsignond_dictionary_new
43 G_DEFINE_TYPE (SSOUIDialog, sso_ui_dialog, G_TYPE_OBJECT)
45 #define UI_DIALOG_PRIVATE(o) \
46 (G_TYPE_INSTANCE_GET_PRIVATE ((o), SSO_TYPE_UI_DIALOG, SSOUIDialogPrivate))
49 struct _SSOUIDialogPrivate {
50 GDBusMethodInvocation *invocation;
51 GSignondSignonuiData *params;
52 const gchar *old_password;
53 const gchar *oauth_final_url;
57 /* hack for automated testing: contains values that should be sent as reply */
60 gchar *oauth_response;
64 Evas_Object *username_entry;
65 Evas_Object *password_entry;
66 Evas_Object *password_confirm1_entry;
67 Evas_Object *password_confirm2_entry;
68 Evas_Object *remember_check;
69 Evas_Object *captcha_image;
70 Evas_Object *captcha_entry;
71 Evas_Object *oauth_web;
86 static guint signals[LAST_SIGNAL] = { 0 };
89 sso_ui_dialog_get_property (GObject *object,
94 SSOUIDialog *self = SSO_UI_DIALOG (object);
99 g_value_set_object (value, self->priv->invocation);
101 case PROP_RETURN_VALUE:
102 g_value_set_boxed (value, sso_ui_dialog_get_return_value (self));
105 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
110 sso_ui_dialog_set_property (GObject *object,
115 SSOUIDialog *self = SSO_UI_DIALOG (object);
118 case PROP_INVOCATION:
119 self->priv->invocation = g_value_get_object (value);
121 case PROP_PARAMETERS: {
122 GSignondSignonuiData *params = g_value_get_boxed (value);
123 sso_ui_dialog_set_parameters (self, params);
126 case PROP_RETURN_VALUE:
130 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
135 sso_ui_dialog_dispose (GObject *object)
137 SSOUIDialog *self = SSO_UI_DIALOG (object);
139 gsignond_signonui_data_unref (self->priv->params);
140 self->priv->params = NULL;
142 g_free (self->priv->test_reply);
143 self->priv->test_reply = NULL;
145 g_free (self->priv->oauth_response);
146 self->priv->oauth_response = NULL;
148 if (self->priv->dialog) {
149 evas_object_del (self->priv->dialog);
150 self->priv->dialog = NULL;
153 G_OBJECT_CLASS (sso_ui_dialog_parent_class)->dispose (object);
157 sso_ui_dialog_class_init (SSOUIDialogClass *klass)
159 GObjectClass *object_class = G_OBJECT_CLASS (klass);
161 g_type_class_add_private (klass, sizeof (SSOUIDialogPrivate));
163 object_class->get_property = sso_ui_dialog_get_property;
164 object_class->set_property = sso_ui_dialog_set_property;
165 object_class->dispose = sso_ui_dialog_dispose;
167 g_object_class_install_property (object_class, PROP_INVOCATION,
168 g_param_spec_object ("invocation", "Invocation",
169 "The GDBusMethodInvocation object for this authentication",
170 G_TYPE_DBUS_METHOD_INVOCATION,
171 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
173 g_object_class_install_property (object_class, PROP_PARAMETERS,
174 g_param_spec_boxed ("parameters", "Parameters",
175 "The GVariant a{sv} that contains the parameters for this dialog",
176 GSIGNOND_TYPE_SIGNONUI_DATA,
179 g_object_class_install_property (object_class, PROP_RETURN_VALUE,
180 g_param_spec_boxed ("return-value", "Return value",
181 "The return value for this dialog. Only defined after closed signal",
182 GSIGNOND_TYPE_SIGNONUI_DATA,
185 signals[CLOSED_SIGNAL] =
186 g_signal_new ("closed",
187 G_TYPE_FROM_CLASS (klass),
189 G_STRUCT_OFFSET (SSOUIDialogClass, closed),
191 g_cclosure_marshal_VOID__VOID,
197 sso_ui_dialog_init (SSOUIDialog *self)
199 SSOUIDialogPrivate *priv = UI_DIALOG_PRIVATE (self);
202 priv->error_code = SIGNONUI_ERROR_NONE;
203 priv->old_password = NULL;
204 priv->oauth_final_url = NULL;
205 priv->oauth_response = NULL;
208 priv->message = NULL;
209 priv->username_entry = NULL;
210 priv->password_entry = NULL;
211 priv->password_confirm1_entry = NULL;
212 priv->password_confirm2_entry = NULL;
213 priv->remember_check = NULL;
214 priv->captcha_image = NULL;
215 priv->captcha_entry = NULL;
216 priv->oauth_web = NULL;
222 close_dialog (SSOUIDialog *self)
224 g_debug ("Dialog %s closed", gsignond_signonui_data_get_request_id (
225 self->priv->params));
227 evas_object_hide (self->priv->dialog);
228 self->priv->dialog = NULL;
230 g_signal_emit (self, signals[CLOSED_SIGNAL], 0);
234 on_cancel_or_close_clicked (void *data, Evas_Object *obj, void *event_info)
236 SSOUIDialog *self = SSO_UI_DIALOG (data);
238 self->priv->error_code = SIGNONUI_ERROR_CANCELED;
243 on_ok_clicked (void *data, Evas_Object *obj, void *event_info)
245 SSOUIDialog *self = SSO_UI_DIALOG (data);
246 SSOUIDialogPrivate *priv = self->priv;
247 gboolean query_confirm = FALSE;
249 gsignond_signonui_data_get_confirm (priv->params, &query_confirm);
252 g_assert (priv->old_password);
254 if (g_strcmp0 (priv->old_password,
255 elm_entry_entry_get (priv->password_entry)) != 0) {
256 g_debug ("Old password does not match, not accepting.");
259 if (g_strcmp0 (elm_entry_entry_get (priv->password_confirm1_entry),
260 elm_entry_entry_get (priv->password_confirm2_entry)) != 0) {
261 g_debug ("New passwords do not match, not accepting.");
266 priv->error_code = SIGNONUI_ERROR_NONE;
271 on_forgot_clicked (void *data, Evas_Object *obj, void *event_info)
273 SSOUIDialog *self = SSO_UI_DIALOG (data);
274 GError *error = NULL;
276 const gchar *forgot_url =
277 gsignond_signonui_data_get_forgot_password_url (self->priv->params);
280 g_warning ("'forgot password' URL is not set.");
284 if (!g_app_info_launch_default_for_uri (forgot_url,
287 g_warning ("Failed to launch default handler for '%s': %s.",
288 forgot_url, error->message);
289 g_clear_error (&error);
293 g_debug ("Launched default handler for 'forgot password' URL %s",
295 self->priv->error_code = SIGNONUI_ERROR_FORGOT_PASSWORD;
300 on_web_url_change (void *data, Evas_Object *obj, void *event_info)
302 SSOUIDialog *self = data;
303 const char *uri = event_info;
305 if (!self->priv->oauth_final_url ||
306 !g_str_has_prefix (uri, self->priv->oauth_final_url))
309 g_debug ("FOUND URL : %s", uri);
310 self->priv->oauth_response = g_strdup (uri);
312 self->priv->error_code = SIGNONUI_ERROR_NONE;
317 on_web_url_load_error (void *data, Evas_Object *obj, void *event_info)
319 const Ewk_Error* error = (const Ewk_Error*)event_info;
321 g_debug ("%s, error %s", __FUNCTION__, ewk_error_description_get(error));
325 on_web_url_load_finished (void *data, Evas_Object *obj, void *event_info)
327 g_debug("%s", __FUNCTION__);
331 add_entry (Evas_Object *window, Evas_Object *container, const gchar *label_text)
333 Evas_Object *frame = NULL;
334 Evas_Object *entry = NULL;
337 frame = elm_frame_add(window);
339 elm_object_text_set(frame, label_text);
340 evas_object_size_hint_weight_set(frame, 0.0, 0.0);
341 evas_object_size_hint_align_set(frame, EVAS_HINT_FILL, EVAS_HINT_FILL);
342 elm_box_pack_end(container, frame);
343 evas_object_show(frame);
346 entry = elm_entry_add (window);
347 elm_entry_single_line_set (entry, EINA_TRUE);
348 elm_entry_scrollable_set (entry, EINA_TRUE);
349 evas_object_size_hint_min_set (entry, 150, 80);
350 evas_object_size_hint_align_set (entry,
351 EVAS_HINT_FILL, EVAS_HINT_FILL);
352 evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, 0.0);
353 frame ? elm_object_content_set (frame, entry)
354 : elm_box_pack_end (container, entry);
360 build_dialog (SSOUIDialog *self)
362 SSOUIDialogPrivate *priv = self->priv;
364 const gchar *str = NULL;
366 Evas_Object *bg, *box, *frame, *content_box;
367 Evas_Object *button_frame, *pad_frame, *button_box;
368 Evas_Object *cancel_button, *ok_button;
371 priv->test_reply = gsignond_signonui_data_get_test_reply (priv->params);
374 priv->dialog = elm_win_add (NULL, "dialog", ELM_WIN_BASIC);
375 str = gsignond_signonui_data_get_title(priv->params);
376 elm_win_title_set (priv->dialog, str ? str : "Single Sign-On");
377 elm_win_center (priv->dialog, EINA_TRUE, EINA_TRUE);
378 evas_object_smart_callback_add (priv->dialog, "delete,request",
379 on_cancel_or_close_clicked, self);
381 /* window background */
382 bg = elm_bg_add (priv->dialog);
383 evas_object_size_hint_weight_set (bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
384 evas_object_show (bg);
385 elm_win_resize_object_add (priv->dialog, bg);
387 box = elm_box_add (priv->dialog);
388 evas_object_size_hint_min_set (box, 200, 200);
389 evas_object_size_hint_weight_set (box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
390 evas_object_show (box);
391 elm_win_resize_object_add (priv->dialog, box);
393 frame = elm_frame_add (priv->dialog);
394 elm_object_style_set (frame, "pad_small");
395 evas_object_size_hint_weight_set (frame,
396 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
397 evas_object_size_hint_align_set (frame,
398 EVAS_HINT_FILL, EVAS_HINT_FILL);
399 evas_object_show (frame);
400 elm_box_pack_start (box, frame);
402 content_box = elm_box_add (priv->dialog);
403 elm_box_padding_set (content_box, 0, 3);
404 evas_object_size_hint_weight_set (content_box,
405 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
406 evas_object_size_hint_align_set (content_box, 0.0, 0.0);
407 evas_object_show (content_box);
408 elm_object_part_content_set (frame, NULL, content_box);
410 /* Web Dialog for Outh */
411 if ((str = gsignond_signonui_data_get_open_url (priv->params))) {
413 priv->oauth_final_url = gsignond_signonui_data_get_final_url (priv->params);
414 g_debug ("Loading url : %s", str);
416 canvas = evas_object_evas_get (priv->dialog);
417 priv->oauth_web = ewk_view_add(canvas);
419 if (!ewk_view_url_set(priv->oauth_web, str))
420 g_warning ("Failed to set URI '%s'", str);
422 evas_object_size_hint_min_set (priv->oauth_web, 400, 300);
423 evas_object_size_hint_weight_set(priv->oauth_web,
424 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
425 evas_object_size_hint_align_set (priv->oauth_web,
426 EVAS_HINT_FILL, EVAS_HINT_FILL);
427 evas_object_smart_callback_add (priv->oauth_web, "url,changed",
428 on_web_url_change, self);
429 evas_object_smart_callback_add (priv->oauth_web, "load,error",
430 on_web_url_load_error, self);
431 evas_object_smart_callback_add (priv->oauth_web, "load,finished",
432 on_web_url_load_finished, self);
433 elm_box_pack_end (content_box, priv->oauth_web);
434 evas_object_show(priv->oauth_web);
437 gboolean query_username = FALSE;
438 gboolean remember = FALSE;
439 gboolean confirm = FALSE;
441 if ((str = gsignond_signonui_data_get_caption (priv->params))) {
442 Evas_Object *caption_label = elm_label_add (priv->dialog);
443 elm_object_text_set (caption_label, str);
444 evas_object_size_hint_align_set (caption_label,
446 evas_object_show (caption_label);
447 elm_box_pack_end (content_box, caption_label);
450 priv->username_entry = add_entry (priv->dialog, content_box, "Username:");
451 gsignond_signonui_data_get_query_username (priv->params, &query_username);
452 str = gsignond_signonui_data_get_username (priv->params);
453 elm_entry_entry_set (priv->username_entry, str ? str : "");
454 g_debug ("Settin username entry to editable %d", query_username || !str ? EINA_TRUE : EINA_FALSE);
455 elm_entry_editable_set (priv->username_entry, query_username || !str ? EINA_TRUE : EINA_FALSE);
457 priv->password_entry = add_entry (priv->dialog, content_box, "Password:");
458 elm_entry_password_set (priv->password_entry, EINA_TRUE);
459 if (gsignond_signonui_data_get_confirm (priv->params, &confirm) && confirm) {
460 priv->old_password = gsignond_signonui_data_get_password (priv->params);
461 elm_entry_entry_set (priv->password_entry, priv->old_password ? priv->old_password : "");
462 elm_entry_editable_set (priv->password_entry, EINA_FALSE);
464 priv->password_confirm1_entry = add_entry (priv->dialog, content_box, "New Password:");
465 elm_entry_password_set (priv->password_confirm1_entry, EINA_TRUE);
467 priv->password_confirm2_entry = add_entry (priv->dialog, content_box, "Confirm New Password:");
468 elm_entry_password_set (priv->password_confirm2_entry, EINA_TRUE);
471 elm_entry_editable_set (priv->password_entry, EINA_TRUE);
473 /* remember password */
474 priv->remember_check = elm_check_add (priv->dialog);
475 elm_object_text_set (priv->remember_check, "Remember password");
476 evas_object_show (priv->remember_check);
477 gsignond_signonui_data_get_remember_password (priv->params, &remember);
478 elm_check_state_set (priv->remember_check, remember);
479 evas_object_size_hint_align_set (priv->remember_check,
480 1.0, EVAS_HINT_FILL);
481 elm_box_pack_end (content_box, priv->remember_check);
483 /* Forgot password link */
484 if ((str =gsignond_signonui_data_get_forgot_password_url (priv->params))) {
485 Evas_Object *forgot_button = elm_button_add (priv->dialog);
486 elm_object_text_set (forgot_button, "Forgot password");
487 evas_object_smart_callback_add (forgot_button, "clicked",
488 on_forgot_clicked, self);
489 evas_object_size_hint_align_set (forgot_button,
490 1.0, EVAS_HINT_FILL);
491 evas_object_size_hint_weight_set (forgot_button, 0.0, 0.0);
492 evas_object_show (forgot_button);
493 elm_box_pack_end (content_box, forgot_button);
496 /* sigh, Elm_Image can't load urls, and ecore can't use temp files sanely*/
497 /* double sigh, ecore_file_download() does not work with file:// ??? */
498 if ((str = gsignond_signonui_data_get_captcha_url (priv->params))) {
499 priv->captcha_image = elm_image_add (priv->dialog);
500 elm_image_aspect_fixed_set (priv->captcha_image, TRUE);
501 evas_object_size_hint_align_set (priv->captcha_image,
502 EVAS_HINT_FILL, EVAS_HINT_FILL);
503 elm_box_pack_end (content_box, priv->captcha_image);
504 priv->captcha_entry = add_entry (priv->dialog, content_box, NULL);
506 sso_ui_dialog_refresh_captcha (self, str);
509 if ((str = gsignond_signonui_data_get_message (priv->params))) {
510 priv->message = elm_label_add (priv->dialog);
511 elm_object_text_set (priv->message, str);
512 evas_object_size_hint_align_set (priv->message,
513 EVAS_HINT_FILL, EVAS_HINT_FILL);
514 elm_box_pack_end (content_box, priv->message);
519 button_frame = elm_frame_add (priv->dialog);
520 elm_object_style_set (button_frame, "outdent_bottom");
521 evas_object_size_hint_weight_set (button_frame, 0.0, 0.0);
522 evas_object_size_hint_align_set (button_frame,
523 EVAS_HINT_FILL, EVAS_HINT_FILL);
524 evas_object_show (button_frame);
525 elm_box_pack_end (box, button_frame);
527 pad_frame = elm_frame_add (priv->dialog);
528 elm_object_style_set (pad_frame, "pad_medium");
529 evas_object_show (pad_frame);
530 elm_object_part_content_set (button_frame, NULL, pad_frame);
532 button_box = elm_box_add (priv->dialog);
533 elm_box_horizontal_set (button_box, 1);
534 elm_box_homogeneous_set (button_box, 1);
535 evas_object_show (button_box);
536 elm_object_part_content_set (pad_frame, NULL, button_box);
540 cancel_button = elm_button_add (priv->dialog);
541 elm_object_text_set (cancel_button, "Cancel");
542 evas_object_size_hint_weight_set (cancel_button,
543 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
544 evas_object_size_hint_align_set (cancel_button,
545 EVAS_HINT_FILL, EVAS_HINT_FILL);
546 evas_object_smart_callback_add (cancel_button, "clicked",
547 on_cancel_or_close_clicked, self);
548 evas_object_show (cancel_button);
549 elm_box_pack_end (button_box, cancel_button);
552 ok_button = elm_button_add (priv->dialog);
553 elm_object_text_set (ok_button, "OK");
554 evas_object_size_hint_weight_set (ok_button,
555 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
556 evas_object_size_hint_align_set (ok_button,
557 EVAS_HINT_FILL, EVAS_HINT_FILL);
558 evas_object_smart_callback_add (ok_button, "clicked", on_ok_clicked, self);
559 evas_object_show (ok_button);
560 elm_box_pack_end (button_box, ok_button);
567 sso_ui_dialog_set_parameters (SSOUIDialog *self,
568 GSignondSignonuiData *parameters)
570 SSOUIDialogPrivate *priv = self->priv;
572 priv->params = gsignond_signonui_data_ref (parameters);
578 sso_ui_dialog_refresh_captcha (SSOUIDialog *self, const gchar *url)
580 g_return_val_if_fail (self && SSO_IS_UI_DIALOG (self), FALSE);
581 g_return_val_if_fail (url, FALSE);
583 gchar *filename = g_filename_from_uri (url, NULL, NULL);
585 g_debug ("Using captcha %s", filename);
586 if (!filename) return FALSE;
587 elm_image_file_set (self->priv->captcha_image, filename, NULL);
593 GDBusMethodInvocation*
594 sso_ui_dialog_get_invocation (SSOUIDialog *self)
596 return self->priv->invocation;
600 sso_ui_dialog_get_request_id (SSOUIDialog *self)
602 return gsignond_signonui_data_get_request_id (self->priv->params);
605 GSignondSignonuiData*
606 sso_ui_dialog_get_return_value (SSOUIDialog *self)
608 SSOUIDialogPrivate *priv = self->priv;
609 GSignondSignonuiData *reply = gsignond_signonui_data_new ();
611 gsignond_signonui_data_set_query_error (reply, priv->error_code);
613 if (priv->error_code == SIGNONUI_ERROR_NONE) {
614 gboolean query_oauth = gsignond_signonui_data_get_open_url (priv->params) != NULL;
617 gsignond_signonui_data_set_url_response (reply, priv->oauth_response);
620 gboolean query_username = FALSE;
621 gboolean query_confirm = FALSE;
622 gsignond_signonui_data_get_query_username (priv->params, &query_username);
623 gsignond_signonui_data_get_confirm (priv->params, &query_confirm);
625 gsignond_signonui_data_set_password (reply,
626 elm_entry_entry_get (query_confirm ?
627 priv->password_confirm1_entry : priv->password_entry));
628 if (priv->remember_check) {
629 gsignond_signonui_data_set_remember_password (reply,
630 elm_check_state_get (priv->remember_check));
633 if (priv->captcha_entry) {
634 gsignond_signonui_data_set_captcha_response (reply,
635 elm_entry_entry_get (priv->captcha_entry));
637 if (query_username) {
638 gsignond_signonui_data_set_username (reply,
639 elm_entry_entry_get (priv->username_entry));
648 sso_ui_dialog_handle_test_reply (SSOUIDialog *self)
651 char **pairs = g_strsplit (self->priv->test_reply, ",", 0);
652 for (iter = pairs; *iter; iter++) {
653 char **pair = g_strsplit (*iter, ":", 2);
654 if (g_strv_length (pair) == 2) {
655 if (g_strcmp0 (pair[0], SSO_UI_KEY_CAPTCHA_RESPONSE) == 0) {
656 if (evas_object_visible_get (self->priv->captcha_entry))
657 elm_entry_entry_set (self->priv->captcha_entry, pair[1]);
658 } else if (g_strcmp0 (pair[0], SSO_UI_KEY_PASSWORD) == 0) {
659 if (evas_object_visible_get (self->priv->password_entry))
660 elm_entry_entry_set (self->priv->password_entry, pair[1]);
661 if (evas_object_visible_get (self->priv->password_confirm1_entry))
662 elm_entry_entry_set (self->priv->password_confirm1_entry, pair[1]);
663 } else if (g_strcmp0 (pair[0], SSO_UI_KEY_QUERY_ERROR_CODE) == 0) {
664 self->priv->error_code = atoi(pair[1]);
665 } else if (g_strcmp0 (pair[0], SSO_UI_KEY_REMEMBER_PASSWORD) == 0) {
666 if (evas_object_visible_get (self->priv->remember_check))
667 elm_check_state_set (self->priv->remember_check, g_strcmp0 (pair[1], "True") == 0);
668 } else if (g_strcmp0 (pair[0], SSO_UI_KEY_URL_RESPONSE) == 0) {
669 if (evas_object_visible_get (self->priv->oauth_web))
670 self->priv->oauth_response = g_strdup (pair[1]);
671 } else if (g_strcmp0 (pair[0], SSO_UI_KEY_USERNAME) == 0) {
672 if (evas_object_visible_get (self->priv->username_entry))
673 elm_entry_entry_set (self->priv->username_entry, pair[1]);
682 sso_ui_dialog_show (SSOUIDialog *self)
684 SSOUIDialogPrivate *priv = self->priv;
686 const gchar *request_id = gsignond_signonui_data_get_request_id (priv->params);
687 gboolean query_oauth = FALSE;
688 gboolean query_username = FALSE;
689 gboolean query_password = FALSE;
690 gboolean query_confirm = FALSE;
692 query_oauth = gsignond_signonui_data_get_open_url (priv->params) != NULL;
693 gsignond_signonui_data_get_query_username (priv->params, &query_username);
694 gsignond_signonui_data_get_query_password (priv->params, &query_password);
695 gsignond_signonui_data_get_confirm (priv->params, &query_confirm);
698 priv->error_code = SIGNONUI_ERROR_BAD_PARAMETERS;
700 } else if (query_oauth) {
701 if (query_username ||
704 priv->error_code = SIGNONUI_ERROR_BAD_PARAMETERS;
707 else if (!priv->oauth_final_url) {
708 priv->error_code = SIGNONUI_ERROR_BAD_PARAMETERS;
711 else if (!priv->oauth_web) {
712 priv->error_code = SIGNONUI_ERROR_NOT_AVAILABLE;
716 else if (!query_username &&
719 priv->error_code = SIGNONUI_ERROR_BAD_PARAMETERS;
721 } else if (query_confirm &&
722 !priv->old_password) {
723 priv->error_code = SIGNONUI_ERROR_BAD_PARAMETERS;
727 if (priv->test_reply) {
728 g_debug ("Filling dialog with given test reply values");
729 sso_ui_dialog_handle_test_reply (self);
733 evas_object_show (priv->dialog);
734 g_debug ("Dialog %s shown", request_id);
740 sso_ui_dialog_close (SSOUIDialog *self)
742 /* TODO : is this really considered cancel ? */
743 self->priv->error_code = SIGNONUI_ERROR_CANCELED;
748 sso_ui_dialog_new (GSignondSignonuiData *parameters,
749 GDBusMethodInvocation *invocation)
751 return g_object_new (SSO_TYPE_UI_DIALOG,
752 "parameters", parameters,
753 "invocation", invocation,