Revamp login
This commit is contained in:
parent
e3c1f9b25d
commit
5c2bdceba0
20
bbs.c
20
bbs.c
@ -510,7 +510,8 @@ void runbbs_real(int socket, char *ip, int ssh) {
|
||||
struct sigaction st;
|
||||
lua_State *L;
|
||||
int do_internal_login = 0;
|
||||
|
||||
int usernotfound;
|
||||
int tries;
|
||||
ipaddress = ip;
|
||||
|
||||
if (!ssh) {
|
||||
@ -563,6 +564,7 @@ void runbbs_real(int socket, char *ip, int ssh) {
|
||||
|
||||
usertimeout = 10;
|
||||
timeoutpaused = 0;
|
||||
tries = 0;
|
||||
|
||||
memset (&sa, 0, sizeof (sa));
|
||||
sa.sa_handler = &timer_handler;
|
||||
@ -579,12 +581,22 @@ void runbbs_real(int socket, char *ip, int ssh) {
|
||||
s_displayansi("issue");
|
||||
|
||||
if (!ssh) {
|
||||
tryagain:
|
||||
s_printf(get_string(19));
|
||||
s_printf(get_string(20));
|
||||
|
||||
s_readstring(buffer, 25);
|
||||
|
||||
usernotfound = 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();
|
||||
gUser = user;
|
||||
} else {
|
||||
@ -592,8 +604,14 @@ void runbbs_real(int socket, char *ip, int ssh) {
|
||||
s_readpass(password, 16);
|
||||
user = check_user_pass(buffer, password);
|
||||
if (user == NULL) {
|
||||
if (tries == 3) {
|
||||
s_printf(get_string(22));
|
||||
disconnect("Incorrect Login");
|
||||
} else {
|
||||
tries++;
|
||||
s_printf(get_string(22));
|
||||
goto tryagain;
|
||||
}
|
||||
}
|
||||
|
||||
gUser = user;
|
||||
|
@ -201,3 +201,4 @@ Is this Correct? (Y/N)
|
||||
\r\nPlease enter a description:\r\n
|
||||
...Found!\r\n\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