aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorSushma Rai <rsushma@src.gnome.org>2006-01-12 17:31:05 +0800
committerSushma Rai <rsushma@src.gnome.org>2006-01-12 17:31:05 +0800
commit368a776689311fce995865c52399cf72551d14ec (patch)
tree81bc9622f1a8c5deff828de3d555c82cedf0af28 /plugins
parentff9fd5da422034c9b02ed54e4683079e015f5cb0 (diff)
downloadgsoc2013-evolution-368a776689311fce995865c52399cf72551d14ec.tar
gsoc2013-evolution-368a776689311fce995865c52399cf72551d14ec.tar.gz
gsoc2013-evolution-368a776689311fce995865c52399cf72551d14ec.tar.bz2
gsoc2013-evolution-368a776689311fce995865c52399cf72551d14ec.tar.lz
gsoc2013-evolution-368a776689311fce995865c52399cf72551d14ec.tar.xz
gsoc2013-evolution-368a776689311fce995865c52399cf72551d14ec.tar.zst
gsoc2013-evolution-368a776689311fce995865c52399cf72551d14ec.zip
Cheking for password expired error code, displaying the error message and
allowing the user to reset password. Also showing password expiry warning message in advance. Fixes #326060. Also, Checking for the quota related error codes and displaying the corresponding error/warning messages to the user. Fixes #326087. svn path=/trunk/; revision=31143
Diffstat (limited to 'plugins')
-rw-r--r--plugins/exchange-operations/ChangeLog20
-rw-r--r--plugins/exchange-operations/Makefile.am3
-rw-r--r--plugins/exchange-operations/exchange-config-listener.c133
-rw-r--r--plugins/exchange-operations/exchange-passwd-expiry.glade91
-rw-r--r--plugins/exchange-operations/org-gnome-exchange-operations.error.xml6
5 files changed, 244 insertions, 9 deletions
diff --git a/plugins/exchange-operations/ChangeLog b/plugins/exchange-operations/ChangeLog
index 74d38601a1..d4bcc4af29 100644
--- a/plugins/exchange-operations/ChangeLog
+++ b/plugins/exchange-operations/ChangeLog
@@ -1,3 +1,23 @@
+2006-01-12 Sushma Rai <rsushma@novell.com>
+
+ * exchange-config-listener.c (exchange_config_listener_authenticate):
+ Checking for the password expired error code during connect and if the
+ password is expired, showing the error message, prompting for resetting
+ the password and trying to connect again with the new password.
+ Checking if the password will expire in next a few days, which is
+ specified by the user during account creation, and if yes, showing
+ the corresponding error message to the user, which allows him to change
+ his password.
+ Fixes #326060.
+ Also, Checking for the quota related error codes and displaying the
+ corresponding error/warning messages to the user. Fixes #326087.
+
+ * org-gnome-exchange-operations.error.xml: Added a space.
+
+ * exchange-passwd-expiry.glade: Added new.
+
+ * Makefile.am: Added exchange-passwd-expiry.glade.
+
2006-01-11 Srinivasa Ragavan <sragavan@novell.com>
** Fixes bug #316100
diff --git a/plugins/exchange-operations/Makefile.am b/plugins/exchange-operations/Makefile.am
index 0696a6735b..3efa32d475 100644
--- a/plugins/exchange-operations/Makefile.am
+++ b/plugins/exchange-operations/Makefile.am
@@ -58,7 +58,8 @@ glade_DATA = \
exchange-delegates.glade \
exchange-folder-tree.glade \
exchange-permissions-dialog.glade \
- e-foreign-folder-dialog.glade
+ e-foreign-folder-dialog.glade \
+ exchange-passwd-expiry.glade
error_DATA = org-gnome-exchange-operations.error
errordir = $(privdatadir)/errors
diff --git a/plugins/exchange-operations/exchange-config-listener.c b/plugins/exchange-operations/exchange-config-listener.c
index d83458ef24..20a9d33c11 100644
--- a/plugins/exchange-operations/exchange-config-listener.c
+++ b/plugins/exchange-operations/exchange-config-listener.c
@@ -28,8 +28,8 @@
#include "exchange-config-listener.h"
#include "exchange-operations.h"
+#include "exchange-change-password.h"
-#include <exchange-account.h>
#include <exchange-constants.h>
#include <exchange-hierarchy.h>
#include <e-folder-exchange.h>
@@ -43,10 +43,14 @@
#include <libedataserver/e-source-list.h>
#include <libedataserver/e-source-group.h>
#include <libedataserverui/e-passwords.h>
+#include <glade/glade-xml.h>
#include <stdlib.h>
#include <string.h>
+#define FILENAME CONNECTOR_GLADEDIR "/exchange-passwd-expiry.glade"
+#define ROOTNODE "passwd_exp_dialog"
+
struct _ExchangeConfigListenerPrivate {
GConfClient *gconf;
guint idle_id;
@@ -582,19 +586,87 @@ remove_account_esources (ExchangeAccount *account)
remove_account_esource (account, EXCHANGE_CONTACTS_FOLDER);
}
+#ifdef HAVE_KRB5
+static char *
+get_new_exchange_password (ExchangeAccount *account)
+{
+ char *old_password, *new_password;
+
+ old_password = exchange_account_get_password (account);
+ new_password = exchange_get_new_password (old_password, 0);
+
+ if (new_password) {
+ exchange_account_set_password (account,
+ old_password,
+ new_password);
+ g_free (old_password);
+ return new_password;
+ }
+ g_free (old_password);
+ return NULL;
+}
+#endif
+
+#ifdef HAVE_KRB5
+static void
+change_passwd_cb (GtkWidget *button, ExchangeAccount *account)
+{
+ char *current_passwd, *new_passwd;
+
+ gtk_widget_hide (gtk_widget_get_toplevel(button));
+ current_passwd = exchange_account_get_password (account);
+ new_passwd = exchange_get_new_password (current_passwd, TRUE);
+ exchange_account_set_password (account, current_passwd, new_passwd);
+ g_free (current_passwd);
+ g_free (new_passwd);
+}
+#endif
+
+static void
+display_passwd_expiry_message (int max_passwd_age, ExchangeAccount *account)
+{
+ GladeXML *xml;
+ GtkWidget *top_widget, *change_passwd_button;
+ GtkResponseType response;
+ GtkLabel *warning_msg_label;
+ char *passwd_expiry_msg =
+ g_strdup_printf (_("Your password will expire in next %d days"), max_passwd_age);
+
+ xml = glade_xml_new (FILENAME, ROOTNODE, NULL);
+ g_return_if_fail (xml != NULL);
+ top_widget = glade_xml_get_widget (xml, ROOTNODE);
+ g_return_if_fail (top_widget != NULL);
+
+ warning_msg_label = GTK_LABEL (glade_xml_get_widget (xml,
+ "passwd_exp_label"));
+ gtk_label_set_text (warning_msg_label, passwd_expiry_msg);
+ change_passwd_button = glade_xml_get_widget (xml,
+ "change_passwd_button");
+ gtk_widget_set_sensitive (change_passwd_button, TRUE);
+ g_signal_connect (change_passwd_button,
+ "clicked",
+ G_CALLBACK (change_passwd_cb),
+ account);
+ response = gtk_dialog_run (GTK_DIALOG (top_widget));
+
+ gtk_widget_destroy (top_widget);
+ g_object_unref (xml);
+ g_free (passwd_expiry_msg);
+}
+
ExchangeAccountResult
exchange_config_listener_authenticate (ExchangeConfigListener *ex_conf_listener, ExchangeAccount *account)
{
ExchangeConfigListenerPrivate *priv;
ExchangeAccountResult result;
- char *key, *password, *title;
+ char *key, *password, *title, *new_password;
gboolean oldremember, remember = FALSE;
CamelURL *camel_url;
const char *remember_password;
g_return_val_if_fail (EXCHANGE_IS_CONFIG_LISTENER (ex_conf_listener), EXCHANGE_ACCOUNT_CONFIG_ERROR);
priv = ex_conf_listener->priv;
-
+
camel_url = camel_url_new (priv->configured_uri, NULL);
key = camel_url_to_string (camel_url, CAMEL_URL_HIDE_PASSWORD | CAMEL_URL_HIDE_PARAMS);
remember_password = camel_url_get_param (camel_url, "save-passwd");
@@ -610,7 +682,7 @@ exchange_config_listener_authenticate (ExchangeConfigListener *ex_conf_listener,
}
g_free (title);
}
- else if (remember_password && !g_strcasecmp (remember_password, "fasle")) {
+ else if (remember_password && !g_strcasecmp (remember_password, "false")) {
/* get_password returns the password cached but user has not
* selected remember password option, forget this password
* whis is stored temporarily by e2k_validate_user(), to avoid
@@ -619,6 +691,57 @@ exchange_config_listener_authenticate (ExchangeConfigListener *ex_conf_listener,
e_passwords_forget_password ("Exchange", key);
}
exchange_account_connect (account, password, &result);
+ g_free (password);
+ if (result == EXCHANGE_ACCOUNT_PASSWORD_EXPIRED) {
+ new_password = get_new_exchange_password (account);
+ if (new_password) {
+ /* try connecting with new password */
+ exchange_account_connect (account, new_password, &result);
+ g_free (new_password);
+ }
+ }
+ else if (result == EXCHANGE_ACCOUNT_QUOTA_RECIEVE_ERROR ||
+ result == EXCHANGE_ACCOUNT_QUOTA_SEND_ERROR ||
+ result == EXCHANGE_ACCOUNT_QUOTA_WARN) {
+ gchar *current_quota_usage;
+
+ switch (result) {
+ case EXCHANGE_ACCOUNT_QUOTA_RECIEVE_ERROR:
+ current_quota_usage = g_strdup_printf ("%.2f",
+ account->mbox_size);
+ e_error_run (NULL, "org-gnome-exchange-operations:account-quota-error", current_quota_usage);
+ g_free (current_quota_usage);
+ break;
+ case EXCHANGE_ACCOUNT_QUOTA_SEND_ERROR:
+ current_quota_usage = g_strdup_printf ("%.2f",
+ account->mbox_size);
+ e_error_run (NULL, "org-gnome-exchange-operations:account-quota-send-error", current_quota_usage);
+ g_free (current_quota_usage);
+ break;
+ case EXCHANGE_ACCOUNT_QUOTA_WARN:
+ current_quota_usage = g_strdup_printf ("%.2f",
+ account->mbox_size);
+ e_error_run (NULL, "org-gnome-exchange-operations:account-quota-warn", current_quota_usage);
+ g_free (current_quota_usage);
+ break;
+ default:
+ break;
+ }
+ /* reset result, so that we check if the password
+ * expiry warning period
+ */
+ result = EXCHANGE_ACCOUNT_CONNECT_SUCCESS;
+
+ }
+ if (result == EXCHANGE_ACCOUNT_CONNECT_SUCCESS) {
+ int max_pwd_age_days;
+
+ /* check for password expiry warning */
+ max_pwd_age_days = exchange_account_check_password_expiry (account);
+ if (max_pwd_age_days >= 0) {
+ display_passwd_expiry_message (max_pwd_age_days, account);
+ }
+ }
g_free (key);
camel_url_free (camel_url);
return result;
@@ -675,7 +798,7 @@ account_added (EAccountList *account_list, EAccount *account)
remove_selected_non_offline_esources (exchange_account, CONF_KEY_TASKS);
return;
}
-
+ exchange_account_set_online (exchange_account);
exchange_config_listener_authenticate (config_listener, exchange_account);
exchange_account_set_online (exchange_account);
}
diff --git a/plugins/exchange-operations/exchange-passwd-expiry.glade b/plugins/exchange-operations/exchange-passwd-expiry.glade
new file mode 100644
index 0000000000..6ea4005c33
--- /dev/null
+++ b/plugins/exchange-operations/exchange-passwd-expiry.glade
@@ -0,0 +1,91 @@
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
+
+<glade-interface>
+<requires lib="gnome"/>
+
+<widget class="GtkDialog" id="passwd_exp_dialog">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">Password Expiry Warning...</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="modal">False</property>
+ <property name="resizable">True</property>
+ <property name="destroy_with_parent">False</property>
+ <property name="has_separator">True</property>
+
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="dialog-vbox1">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child internal-child="action_area">
+ <widget class="GtkHButtonBox" id="dialog-action_area1">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+
+ <child>
+ <widget class="GtkButton" id="change_passwd_button">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="has_focus">True</property>
+ <property name="label" translatable="yes">_Change Password</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="response_id">0</property>
+ <accelerator key="C" modifiers="GDK_MOD1_MASK" signal="clicked"/>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="ok_button">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-ok</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="response_id">-5</property>
+ <accessibility>
+ <atkproperty name="AtkObject::accessible_name" translatable="yes">ok_button</atkproperty>
+ </accessibility>
+ <accelerator key="O" modifiers="GDK_MOD1_MASK" signal="clicked"/>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="passwd_exp_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Your password will expire in 7 days...</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_CENTER</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">20</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+</widget>
+
+</glade-interface>
diff --git a/plugins/exchange-operations/org-gnome-exchange-operations.error.xml b/plugins/exchange-operations/org-gnome-exchange-operations.error.xml
index 1edd1dd8f5..3e22e3ccbb 100644
--- a/plugins/exchange-operations/org-gnome-exchange-operations.error.xml
+++ b/plugins/exchange-operations/org-gnome-exchange-operations.error.xml
@@ -102,17 +102,17 @@ supports Microsoft Exchange 2000 and 2003 only.</_secondary>
<error id="account-quota-error" type="error">
<_primary>You have exceeded your quota for storing mails on this server.</_primary>
- <_secondary>Your current usage is: {0}KB. You will not be able to either send or recieve mails now.</_secondary>
+ <_secondary>Your current usage is: {0} KB. You will not be able to either send or recieve mails now.</_secondary>
</error>
<error id="account-quota-send-error" type="warning">
<_primary>You are nearing your quota available for storing mails on this server.</_primary>
- <_secondary>Your current usage is: {0}KB. You will not be able to send mails till you clear up some space by deleting some mails.</_secondary>
+ <_secondary>Your current usage is: {0} KB. You will not be able to send mails till you clear up some space by deleting some mails.</_secondary>
</error>
<error id="account-quota-warn" type="warning">
<_primary>You are nearing your quota available for storing mails on this server.</_primary>
- <_secondary>Your current usage is: {0}KB. Try to clear up some space by deleting some mails.</_secondary>
+ <_secondary>Your current usage is: {0} KB. Try to clear up some space by deleting some mails.</_secondary>
</error>
<error id="connect-exchange-error" type="error">