diff options
author | Sushma Rai <rsushma@src.gnome.org> | 2005-01-09 21:15:33 +0800 |
---|---|---|
committer | Sushma Rai <rsushma@src.gnome.org> | 2005-01-09 21:15:33 +0800 |
commit | b9d38cc653c017dcb78a67a0660a9a18e0f326b5 (patch) | |
tree | bca3b3edbd60624de1b852f0bc2f957c8c14dcb8 | |
parent | 6de819c7dd36d1c5820826abe4956a6bc4b969b7 (diff) | |
download | gsoc2013-evolution-b9d38cc653c017dcb78a67a0660a9a18e0f326b5.tar.gz gsoc2013-evolution-b9d38cc653c017dcb78a67a0660a9a18e0f326b5.tar.zst gsoc2013-evolution-b9d38cc653c017dcb78a67a0660a9a18e0f326b5.zip |
Authentication for exchange account
svn path=/trunk/; revision=28296
4 files changed, 143 insertions, 1 deletions
diff --git a/plugins/exchange-account-setup/ChangeLog b/plugins/exchange-account-setup/ChangeLog index 8c9375546b..61e0b4b7b0 100644 --- a/plugins/exchange-account-setup/ChangeLog +++ b/plugins/exchange-account-setup/ChangeLog @@ -1,3 +1,10 @@ 2005-01-09 Sushma Rai <rsushma@novell.com> + + * exchange-ask-password.c: Pops up password dialog and validates + user credentials once owa url and user name are entered. + + * org-gnome-exchange-account-setup.eplug.in: Added page check plugin. + +2005-01-09 Sushma Rai <rsushma@novell.com> * Intial ckeckin, Plugin for Exchange account specific settings diff --git a/plugins/exchange-account-setup/Makefile.am b/plugins/exchange-account-setup/Makefile.am index 516a6ba016..47d5f1cddc 100644 --- a/plugins/exchange-account-setup/Makefile.am +++ b/plugins/exchange-account-setup/Makefile.am @@ -9,7 +9,8 @@ plugin_DATA = org-gnome-exchange-account-setup.eplug plugin_LTLIBRARIES = liborg-gnome-exchange-account-settings.la liborg_gnome_exchange_account_settings_la_SOURCES = \ - exchange-account-setup.c + exchange-account-setup.c \ + exchange-ask-password.c liborg_gnome_exchange_account_settings_la_LIBADD = \ $(top_builddir)/e-util/libeutil.la \ diff --git a/plugins/exchange-account-setup/exchange-ask-password.c b/plugins/exchange-account-setup/exchange-ask-password.c new file mode 100644 index 0000000000..1474613959 --- /dev/null +++ b/plugins/exchange-account-setup/exchange-ask-password.c @@ -0,0 +1,113 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- + * + * Sushma Rai <rsushma@novell.com> + * Copyright (C) 2004 Novell, Inc. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include <string.h> +#include <libgnome/gnome-i18n.h> +#include <glade/glade.h> +#include <gtk/gtk.h> +#include <gtk/gtkdialog.h> +#include <camel/camel-provider.h> +#include <camel/camel-url.h> +#include "mail/em-account-editor.h" +#include "mail/em-config.h" +#include "e-util/e-account.h" +#include "e-util/e-passwords.h" +#include "e-util/e-config.h" + +int e_plugin_lib_enable (EPluginLib *ep, int enable); + +gboolean org_gnome_exchange_ask_password (EPlugin *epl, EConfigHookPageCheckData *data); + +static gboolean +validate_exchange_user (EConfig *ec, const char *pageid, void *data) +{ + EMConfigTargetAccount *target_account = data; + CamelURL *url=NULL; + CamelProvider *provider = NULL; + gboolean valid = TRUE; + char *account_url, *url_string; + static int count = 0; + + if (count) + return valid; + + account_url = g_strdup (target_account->account->source->url); + url = camel_url_new_with_base (NULL, account_url); + provider = camel_provider_get (account_url, NULL); + g_free (account_url); + if (!provider) { + return FALSE; /* This should never happen */ + } + + valid = camel_provider_validate_user (provider, url, NULL); + if (valid) { + count ++; + url_string = camel_url_to_string (url, 0); + target_account->account->source->url = url_string; + } + return valid; +} + +#if 0 +int +e_plugin_lib_enable (EPluginLib *ep, int enable) +{ + if (enable) { + } + return 0; +} +#endif + +gboolean +org_gnome_exchange_ask_password(EPlugin *epl, EConfigHookPageCheckData *data) +{ + EMConfigTargetAccount *target_account; + EConfig *config; + char *account_url = NULL, *exchange_url = NULL; + GtkWidget *page; + + if (strcmp (data->pageid, "10.receive")) + return TRUE; + + config = data->config; + target_account = (EMConfigTargetAccount *)data->config->target; + account_url = g_strdup (target_account->account->source->url); + exchange_url = g_strrstr (account_url, "exchange"); + + /* On page next signal, authenticate user and allow + * to go to receive options page only if user is a valid user */ + + if (exchange_url) { + page = e_config_get_druid_page (config); + g_signal_connect (page, "next", G_CALLBACK(validate_exchange_user), target_account); + g_free (account_url); + return TRUE; + } + else { + g_free (account_url); + return TRUE; + } +} diff --git a/plugins/exchange-account-setup/org-gnome-exchange-account-setup.eplug.in b/plugins/exchange-account-setup/org-gnome-exchange-account-setup.eplug.in index 3d264b7f0c..bb5c3a4f99 100644 --- a/plugins/exchange-account-setup/org-gnome-exchange-account-setup.eplug.in +++ b/plugins/exchange-account-setup/org-gnome-exchange-account-setup.eplug.in @@ -19,4 +19,25 @@ </group> </hook> </e-plugin> + + <e-plugin + type="shlib" + id="org.gnome.evolution.plugin.exchange-ask-password" + location="@PLUGINDIR@/liborg-gnome-exchange-account-settings.so" + load-on-startup="true" + name="Exchange Password Dialog" + description="A pluign to read password once the user enters identity information"> + <hook class="org.gnome.evolution.mail.config:1.0"> + <group + target="account" + id="org.gnome.evolution.mail.config.accountDruid" + check="org_gnome_exchange_ask_password"> + + <item + path="90.dummy"/> + </group> + </hook> + </e-plugin> + + </e-plugin-list> |