AmendHub

Download:

jcs

/

subtext

/

amendments

/

574

session: Fix 'new'/'signup' login going straight to signup


jcs made amendment 574 about 1 year ago
--- session.c Tue Nov 28 12:39:34 2023 +++ session.c Tue Dec 5 11:24:09 2023 @@ -246,6 +246,14 @@ session_run(struct uthread *uthread, void *arg) s->area = SESSION_AREA_MOTD; session_print_motd(s, false); + + if (auth == AUTH_USER_SIGNUP) { + auth = AUTH_USER_GUEST; + session_output(s, "\r\n", 2); + + s->area = SESSION_AREA_SIGNUP; + s->user = signup(s); + } main_menu: s->area = SESSION_AREA_MAIN_MENU; @@ -261,11 +269,7 @@ main_menu: get_another_char: action = ACTION_NONE; - if (auth == AUTH_USER_SIGNUP) { - action = ACTION_SIGNUP; - auth = AUTH_USER_GUEST; - } else - c = session_input_char(s); + c = session_input_char(s); if (s->ending) break; @@ -364,11 +368,8 @@ get_another_char: break; case ACTION_SIGNUP: s->area = SESSION_AREA_SIGNUP; - if ((s->user = signup(s))) { - session_printf(s, "\r\n" - "Welcome, {{B}}%s{{/B}}!\r\n", s->user->username); + if ((s->user = signup(s))) goto main_menu; - } break; case ACTION_WHOS_ONLINE: s->area = SESSION_AREA_WHO; --- signup.c Mon Nov 27 21:14:30 2023 +++ signup.c Tue Dec 5 10:45:20 2023 @@ -117,6 +117,9 @@ signup(struct session *s) user_cache_usernames(); session_logf(s, "New user account created for %s", user->username); + + session_printf(s, "\r\nWelcome, {{B}}%s{{/B}}!\r\n", user->username); + session_flush(s); signup_done: if (username != NULL)