Auto-generated email address is now derived from the screen name. Fall back to other...
[citadel.git] / citadel / user_ops.c
index 05f2fa0fbffeb00886a99a436f627f7e9525a8cf..dab7f296baed524f125cc5f849672ad6f5805998 100644 (file)
@@ -654,11 +654,7 @@ void do_login(void)
 
        /* If the user does not have any email addresses assigned, generate one. */
        if (IsEmptyStr(CC->user.emailaddrs)) {
-               char synthetic_email_addr[1024];
-               snprintf(synthetic_email_addr, sizeof synthetic_email_addr, "ctdl%08lx@%s", CC->user.usernum, CtdlGetConfigStr("c_fqdn"));
-               CtdlSetEmailAddressesForUser(CC->user.fullname, synthetic_email_addr);
-               strncpy(CC->user.emailaddrs, synthetic_email_addr, sizeof(CC->user.emailaddrs));
-               syslog(LOG_DEBUG, "user_ops: auto-generated email address <%s> for <%s>", synthetic_email_addr, CC->user.fullname);
+               AutoGenerateEmailAddressForUser(&CC->user);
        }
 
        /*
@@ -721,7 +717,7 @@ void CtdlUserLogout(void)
        strcpy(CCC->fake_roomname, "");
        CCC->logged_in = 0;
 
-       /* Check to see if the user was deleted whilst logged in and purge them if necessary */
+       /* Check to see if the user was deleted while logged in and purge them if necessary */
        if ((CCC->user.axlevel == AxDeleted) && (CCC->user.usernum)) {
                purge_user(CCC->user.fullname);
        }
@@ -942,8 +938,9 @@ int purge_user(char pname[])
        makeuserkey(usernamekey, pname, cutuserkey(pname));
 
        /* If the name is empty we can't find them in the DB any way so just return */
-       if (IsEmptyStr(pname))
+       if (IsEmptyStr(pname)) {
                return(ERROR + NO_SUCH_USER);
+       }
 
        if (CtdlGetUser(&usbuf, pname) != 0) {
                syslog(LOG_ERR, "user_ops: cannot purge user <%s> - not found", pname);