Update of /cvsroot/gqclient/gq/src
In directory usw-pr-cvs1:/tmp/cvs-serv27814
Modified Files:
prefs.c
Log Message:
* Added another password field to have the user enter the password twice
* Added the code to require matching passwords
Index: prefs.c
===================================================================
RCS file: /cvsroot/gqclient/gq/src/prefs.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** prefs.c 3 Jul 2002 20:13:05 -0000 1.22
--- prefs.c 3 Jul 2002 20:53:16 -0000 1.23
***************
*** 60,64 ****
struct ldapserver *server, *servers;
int server_name_changed;
! char *text, *passwdtext;
#if HAVE_LDAP_CLIENT_CACHE
char *ep;
--- 60,65 ----
struct ldapserver *server, *servers;
int server_name_changed;
! char *text, *passwdtext, *passwdtext2;
! gboolean passwdmatch;
#if HAVE_LDAP_CLIENT_CACHE
char *ep;
***************
*** 74,82 ****
passwdtext = gtk_entry_get_text(GTK_ENTRY(field));
if (passwdtext && strlen(passwdtext) > 0) {
int rc =
question_popup(_("Warning: Cleartext password"),
_("The password you have entered will be stored as clear text in your\n"
! "HOME directory in the file " RCFILE ". This file will not be readable\n"
"by anybody else (except the system administrator), but you may\n"
"nevertheless prefer to not store your bind password as clear text.\n\n"
--- 75,99 ----
passwdtext = gtk_entry_get_text(GTK_ENTRY(field));
+ field = get_widget(window, "bindpw2");
+ passwdtext2 = gtk_entry_get_text(GTK_ENTRY(field));
+
+ if (passwdtext == NULL && passwdtext2 == NULL) {
+ passwdmatch = TRUE;
+ } else if (passwdtext && passwdtext2) {
+ passwdmatch = strcmp(passwdtext, passwdtext2) == 0;
+ } else { /* one is missing */
+ passwdmatch = FALSE;
+ }
+
+ if (!passwdmatch) {
+ single_warning_popup(_("Passwords do not match"));
+ return;
+ }
+
if (passwdtext && strlen(passwdtext) > 0) {
int rc =
question_popup(_("Warning: Cleartext password"),
_("The password you have entered will be stored as clear text in your\n"
! "HOME directory in the file .gq. This file will not be readable\n"
"by anybody else (except the system administrator), but you may\n"
"nevertheless prefer to not store your bind password as clear text.\n\n"
***************
*** 236,242 ****
}
! static void ask_pw_toggled(GtkToggleButton *button, GtkWidget *bindpw)
{
! gtk_widget_set_sensitive(bindpw, !gtk_toggle_button_get_active(button));
}
--- 253,263 ----
}
! static void ask_pw_toggled(GtkToggleButton *button, GtkWidget *window)
{
! GtkWidget *field = get_widget(window, "bindpw");
! gtk_widget_set_sensitive(field, !gtk_toggle_button_get_active(button));
!
! field = get_widget(window, "bindpw2");
! gtk_widget_set_sensitive(field, !gtk_toggle_button_get_active(button));
}
***************
*** 249,253 ****
GtkWidget *label, *entry, *button;
GtkWidget *okbutton, *cancelbutton;
! GtkWidget *bindpw;
int y, editing_new_server;
char title[MAX_SERVERNAME_LEN + 8];
--- 270,274 ----
GtkWidget *label, *entry, *button;
GtkWidget *okbutton, *cancelbutton;
! GtkWidget *bindpw, *bindpw2;
int y, editing_new_server;
char title[MAX_SERVERNAME_LEN + 8];
***************
*** 433,436 ****
--- 454,478 ----
y++;
+ /* Bind Password (again)*/
+ label = gtk_label_new(_("Bind Password (again)"));
+ gtk_misc_set_alignment(GTK_MISC(label), 0.0, .5);
+ gtk_widget_show(label);
+ gtk_table_attach(GTK_TABLE(table2), label, 0, 1, y, y + 1,
+ GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
+
+ bindpw2 = entry = gtk_entry_new();
+ /* Follow the suggestion of Jacek Konieczny <ja...@bn...>,
+ (even though Bert won't like it[?]) and do not show the password
+ in cleartext... */
+ gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE);
+ gtk_object_set_data(GTK_OBJECT(editwindow), "bindpw2", entry);
+ gtk_entry_set_text(GTK_ENTRY(entry), server->bindpw);
+ gtk_widget_show(entry);
+ gtk_signal_connect(GTK_OBJECT(entry), "activate",
+ GTK_SIGNAL_FUNC(server_edit_callback), server);
+ gtk_table_attach(GTK_TABLE(table2), entry, 1, 2, y, y + 1,
+ GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
+ y++;
+
/* Bind type */
label = gtk_label_new(_("Bind type"));
***************
*** 522,525 ****
--- 564,568 ----
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), TRUE);
gtk_widget_set_sensitive(GTK_WIDGET(bindpw), FALSE);
+ gtk_widget_set_sensitive(GTK_WIDGET(bindpw2), FALSE);
}
|