]> code.citadel.org Git - citadel.git/blobdiff - webcit/auth.c
* do_edit_vcard() accept arbitrary url's for return_to. Doesn't work yet because...
[citadel.git] / webcit / auth.c
index 3913a103213463c45d4a4ed4e6789a77853dabb6..1ac3921c423dcd416838b810c171b7676f1e6946 100644 (file)
@@ -506,7 +506,7 @@ void do_welcome(void)
         */
        if (!get_preference("startpage", &Buf)) {
                Buf = NewStrBuf ();
-               StrBufPrintf(Buf, "dotskip&room=_BASEROOM_");
+               StrBufPrintf(Buf, "dotskip?room=_BASEROOM_");
                set_preference("startpage", Buf, 1);
        }
        if (ChrPtr(Buf)[0] == '/') {
@@ -741,14 +741,19 @@ void validate(void)
 void display_reg(int during_login)
 {
        StrBuf *Buf;
-       message_summary *VCMsg;
-       wc_mime_attachment *VCAtt;
+       message_summary *VCMsg = NULL;
+       wc_mime_attachment *VCAtt = NULL;
        long vcard_msgnum;
 
        Buf = NewStrBuf();
        if (goto_config_room(Buf) != 0) {
-               if (during_login) do_welcome();
-               else display_main_menu();
+               lprintf(9, "display_reg() exiting because goto_config_room() failed\n");
+               if (during_login) {
+                       do_welcome();
+               }
+               else {
+                       display_main_menu();
+               }
                FreeStrBuf(&Buf);
                return;
        }
@@ -756,8 +761,13 @@ void display_reg(int during_login)
        FreeStrBuf(&Buf);
        vcard_msgnum = locate_user_vcard_in_this_room(&VCMsg, &VCAtt);
        if (vcard_msgnum < 0L) {
-               if (during_login) do_welcome();
-               else display_main_menu();
+               lprintf(9, "display_reg() exiting because locate_user_vcard_in_this_room() failed\n");
+               if (during_login) {
+                       do_welcome();
+               }
+               else {
+                       display_main_menu();
+               }
                return;
        }
 
@@ -765,9 +775,21 @@ void display_reg(int during_login)
                do_edit_vcard(vcard_msgnum, "1", VCMsg, VCAtt, "do_welcome", USERCONFIGROOM);
        }
        else {
-               do_edit_vcard(vcard_msgnum, "1", VCMsg, VCAtt, "display_main_menu", USERCONFIGROOM);
+               StrBuf *ReturnTo;
+               ReturnTo = NewStrBufPlain(HKEY("display_main_menu?gotofirst="));
+               StrBufAppendBuf(ReturnTo, WC->wc_roomname, 0);
+               lprintf(9, "\e[32mwc_roomname: %s\e[0m\n", ChrPtr(WC->wc_roomname));
+               lprintf(9, "\e[31m   ReturnTo: %s\e[0m\n", ChrPtr(ReturnTo));
+               do_edit_vcard(vcard_msgnum, "1", VCMsg, VCAtt, ChrPtr(ReturnTo), USERCONFIGROOM);
+               FreeStrBuf(&ReturnTo);
        }
 
+       /*
+               FIXME
+               1. don't we have to free VCMsg and VCAtt ??
+               2. Fix bug 268
+       */
+
 }
 
 
@@ -892,11 +914,14 @@ int ConditionalRoomAide(StrBuf *Target, WCTemplputParams *TP)
        return (WCC != NULL)? (WCC->is_room_aide == 0) : 0;
 }
 
+
 int ConditionalIsLoggedIn(StrBuf *Target, WCTemplputParams *TP) 
 {
        wcsession *WCC = WC;
        return (WCC != NULL)? (WCC->logged_in == 0) : 0;
 }
+
+
 int ConditionalRoomAcessDelete(StrBuf *Target, WCTemplputParams *TP)
 {
        wcsession *WCC = WC;
@@ -904,9 +929,15 @@ int ConditionalRoomAcessDelete(StrBuf *Target, WCTemplputParams *TP)
 }
 
 
+void _display_openid_login(void) {
+       display_openid_login(NULL);
+}
+
+
+void _display_reg(void) {
+       display_reg(0);
+}
 
-void _display_openid_login(void) {display_openid_login(NULL);}
-void _display_reg(void) {display_reg(0);}
 
 void Header_HandleAuth(StrBuf *Line, ParsedHttpHdrs *hdr)
 {