Revamp login
This commit is contained in:
parent
e3c1f9b25d
commit
5c2bdceba0
26
bbs.c
26
bbs.c
@ -510,7 +510,8 @@ void runbbs_real(int socket, char *ip, int ssh) {
|
|||||||
struct sigaction st;
|
struct sigaction st;
|
||||||
lua_State *L;
|
lua_State *L;
|
||||||
int do_internal_login = 0;
|
int do_internal_login = 0;
|
||||||
|
int usernotfound;
|
||||||
|
int tries;
|
||||||
ipaddress = ip;
|
ipaddress = ip;
|
||||||
|
|
||||||
if (!ssh) {
|
if (!ssh) {
|
||||||
@ -563,7 +564,8 @@ void runbbs_real(int socket, char *ip, int ssh) {
|
|||||||
|
|
||||||
usertimeout = 10;
|
usertimeout = 10;
|
||||||
timeoutpaused = 0;
|
timeoutpaused = 0;
|
||||||
|
tries = 0;
|
||||||
|
|
||||||
memset (&sa, 0, sizeof (sa));
|
memset (&sa, 0, sizeof (sa));
|
||||||
sa.sa_handler = &timer_handler;
|
sa.sa_handler = &timer_handler;
|
||||||
sa.sa_flags = SA_RESTART;
|
sa.sa_flags = SA_RESTART;
|
||||||
@ -579,12 +581,22 @@ void runbbs_real(int socket, char *ip, int ssh) {
|
|||||||
s_displayansi("issue");
|
s_displayansi("issue");
|
||||||
|
|
||||||
if (!ssh) {
|
if (!ssh) {
|
||||||
|
tryagain:
|
||||||
s_printf(get_string(19));
|
s_printf(get_string(19));
|
||||||
s_printf(get_string(20));
|
s_printf(get_string(20));
|
||||||
|
|
||||||
s_readstring(buffer, 25);
|
s_readstring(buffer, 25);
|
||||||
|
|
||||||
|
usernotfound = 0;
|
||||||
|
|
||||||
if (strcasecmp(buffer, "new") == 0) {
|
if (strcasecmp(buffer, "new") == 0) {
|
||||||
|
usernotfound = 1;
|
||||||
|
} else if (check_user(buffer)) {
|
||||||
|
usernotfound = 1;
|
||||||
|
s_printf(get_string(203));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (usernotfound) {
|
||||||
user = new_user();
|
user = new_user();
|
||||||
gUser = user;
|
gUser = user;
|
||||||
} else {
|
} else {
|
||||||
@ -592,8 +604,14 @@ void runbbs_real(int socket, char *ip, int ssh) {
|
|||||||
s_readpass(password, 16);
|
s_readpass(password, 16);
|
||||||
user = check_user_pass(buffer, password);
|
user = check_user_pass(buffer, password);
|
||||||
if (user == NULL) {
|
if (user == NULL) {
|
||||||
s_printf(get_string(22));
|
if (tries == 3) {
|
||||||
disconnect("Incorrect Login");
|
s_printf(get_string(22));
|
||||||
|
disconnect("Incorrect Login");
|
||||||
|
} else {
|
||||||
|
tries++;
|
||||||
|
s_printf(get_string(22));
|
||||||
|
goto tryagain;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gUser = user;
|
gUser = user;
|
||||||
|
@ -201,3 +201,4 @@ Is this Correct? (Y/N)
|
|||||||
\r\nPlease enter a description:\r\n
|
\r\nPlease enter a description:\r\n
|
||||||
...Found!\r\n\r\n
|
...Found!\r\n\r\n
|
||||||
\e[1;32mUpload Successful!\e[0m\r\n
|
\e[1;32mUpload Successful!\e[0m\r\n
|
||||||
|
\e[1;31mUser not found! Assuming new user...\e[0m\r\n\r\n
|
||||||
|
Reference in New Issue
Block a user