]> code.citadel.org Git - citadel.git/blobdiff - webcit/useredit.c
* WebCit now clarifies, using a localized message (or at
[citadel.git] / webcit / useredit.c
index 265f9158792467ba1add965fb165f13269b1fbc1..699cee0c5248261e355aa6e27c033fca017e8e68 100644 (file)
@@ -24,14 +24,13 @@ void select_user_to_edit(char *message, char *preselect)
 
        output_headers(1, 1, 2, 0, 0, 0);
        wprintf("<div id=\"banner\">\n");
-       wprintf("<table width=100%% border=0 bgcolor=#444455><tr>"
-               "<td>"
-               "<span class=\"titlebar\">"
-               "<img src=\"static/usermanag_48x.gif\">");
+       wprintf("<img src=\"static/usermanag_48x.gif\">");
+        wprintf("<h1>");
        wprintf(_("Edit or delete users"));
-       wprintf("</span></td></tr></table>\n"
-               "</div>\n<div id=\"content\">\n"
-       );
+        wprintf("</h1>");
+        wprintf("</div>");
+
+        wprintf("<div id=\"content\" class=\"service\">\n");
 
        if (message != NULL) wprintf(message);
 
@@ -45,6 +44,7 @@ void select_user_to_edit(char *message, char *preselect)
        wprintf("<br /><br />");
 
         wprintf("<center><form method=\"POST\" action=\"create_user\">\n");
+       wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
         wprintf(_("New user: "));
         wprintf("<input type=\"text\" name=\"username\"><br />\n"
                "<input type=\"submit\" name=\"create_button\" value=\"%s\">"
@@ -63,6 +63,7 @@ void select_user_to_edit(char *message, char *preselect)
        
         wprintf("<center>"
                "<form method=\"POST\" action=\"display_edituser\">\n");
+       wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
         wprintf("<select name=\"username\" size=10 style=\"width:100%%\">\n");
         serv_puts("LIST");
         serv_getln(buf, sizeof buf);
@@ -135,8 +136,8 @@ TRYAGAIN:
                                if (!strncasecmp(buf, "part=", 5)) {
                                        extract_token(partnum, &buf[5], 2, '|', sizeof partnum);
                                        extract_token(content_type, &buf[5], 4, '|', sizeof content_type);
-                                       if (!strcasecmp(content_type,
-                                          "text/x-vcard")) {
+                                       if (  (!strcasecmp(content_type, "text/x-vcard"))
+                                          || (!strcasecmp(content_type, "text/vcard")) ) {
                                                vcard_msgnum = stuff->msgnum;
                                        }
                                }
@@ -207,7 +208,7 @@ void display_edit_address_book_entry(char *username, long usernum) {
                return;
        }
 
-       do_edit_vcard(vcard_msgnum, "1", "select_user_to_edit");
+       do_edit_vcard(vcard_msgnum, "1", "select_user_to_edit", roomname);
 }
 
 
@@ -266,27 +267,28 @@ void display_edituser(char *supplied_username, int is_new) {
        lastcall = extract_long(&buf[4], 7);
        purgedays = extract_long(&buf[4], 8);
 
-       if (strlen(bstr("edit_abe_button")) > 0) {
+       if (!IsEmptyStr(bstr("edit_abe_button"))) {
                display_edit_address_book_entry(username, usernum);
                return;
        }
 
-       if (strlen(bstr("delete_button")) > 0) {
+       if (!IsEmptyStr(bstr("delete_button"))) {
                delete_user(username);
                return;
        }
 
        output_headers(1, 1, 2, 0, 0, 0);
        wprintf("<div id=\"banner\">\n");
-       wprintf("<table width=100%% border=0 bgcolor=\"#444455\"><tr><td>");
-       wprintf("<span class=\"titlebar\">");
+       wprintf("<h1>");
        wprintf(_("Edit user account: "));
        escputs(username);
-       wprintf("</span></td></tr></table>\n");
-       wprintf("</div>\n<div id=\"content\">\n");
+        wprintf("</h1>");
+        wprintf("</div>");
+
+        wprintf("<div id=\"content\" class=\"service\">\n");
 
        wprintf("<div class=\"fix_scrollbar_bug\">"
-               "<table border=0 width=100%% bgcolor=\"#ffffff\"><tr><td>\n");
+               "<table class=\"useredit_background\"><tr><td>\n");
        wprintf("<form method=\"POST\" action=\"edituser\">\n"
                "<input type=\"hidden\" name=\"username\" value=\"");
        escputs(username);
@@ -294,6 +296,7 @@ void display_edituser(char *supplied_username, int is_new) {
        wprintf("<input type=\"hidden\" name=\"is_new\" value=\"%d\">\n"
                "<input type=\"hidden\" name=\"usernum\" value=\"%ld\">\n",
                is_new, usernum);
+       wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
 
        wprintf("<input type=\"hidden\" name=\"flags\" value=\"%d\">\n", flags);
 
@@ -398,7 +401,7 @@ void edituser(void) {
 
        is_new = atoi(bstr("is_new"));
 
-       if (strlen(bstr("ok_button")) == 0) {
+       if (IsEmptyStr(bstr("ok_button"))) {
                safestrncpy(message, _("Changes were not saved."), sizeof message);
        }
        else {
@@ -482,10 +485,19 @@ void create_user(void) {
        serv_getln(buf, sizeof buf);
 
        if (buf[0] == '2') {
-               sprintf(WC->ImportantMessage,
-                       _("A new user has been created."));
+               sprintf(WC->ImportantMessage, _("A new user has been created."));
                display_edituser(username, 1);
        }
+       else if (!strncmp(buf, "570", 3)) {
+               sprintf(error_message,
+                       "<img src=\"static/error.gif\" align=center>"
+                       "%s<br /><br />\n",
+                       _("You are attempting to create a new user from within Citadel "
+                       "while running in host based authentication mode.  In this mode, "
+                       "you must create new users on the host system, not within Citadel.")
+               );
+               select_user_to_edit(error_message, NULL);
+       }
        else {
                sprintf(error_message,
                        "<img src=\"static/error.gif\" align=center>"