Fix user registration, broken by #5883b5ca

This commit is contained in:
Deon George 2022-05-09 22:24:28 +10:00
parent 17a90126b0
commit 998a201fbb
2 changed files with 19 additions and 9 deletions

View File

@ -20,6 +20,7 @@ log(LOG_DEBUG,'+ Control REGISTER loaded');
function register() { function register() {
var code = ''; var code = '';
var complete = false; var complete = false;
var processed = false;
// Called before processing for a field // Called before processing for a field
Object.defineProperty(this, 'getName', { Object.defineProperty(this, 'getName', {
@ -30,7 +31,7 @@ function register() {
Object.defineProperty(this, 'isComplete', { Object.defineProperty(this, 'isComplete', {
get: function () { get: function () {
return complete; return complete && processed;
} }
}); });
@ -42,6 +43,11 @@ function register() {
} }
log(LOG_DEBUG,'Control REGISTER handle() start. ('+read+')'); log(LOG_DEBUG,'Control REGISTER handle() start. ('+read+')');
if (cf === undefined) {
log(LOG_DEBUG,' - CF not defined, returning');
return read;
}
log(LOG_DEBUG,'- Field '+cf.fname+'('+JSON.stringify(cf)+')'); log(LOG_DEBUG,'- Field '+cf.fname+'('+JSON.stringify(cf)+')');
if ((cf.fname === 'TOKEN') && (read === '#' || read === "\r")) { if ((cf.fname === 'TOKEN') && (read === '#' || read === "\r")) {
@ -146,13 +152,15 @@ function register() {
fo.sendBaseline('USER_EXISTS',false); fo.sendBaseline('USER_EXISTS',false);
log(LOG_ERROR,"New user couldn't be created (user created while signing up)"); log(LOG_ERROR,"New user couldn't be created (user created while signing up)");
log(LOG_ERROR,JSON.stringify(e)); log(LOG_ERROR,JSON.stringify(e));
return; processed = true;
return this.isComplete;
} }
if (typeof newuser === 'number') { if (typeof newuser === 'number') {
fo.sendBaseline('USER_CREATE_ERROR',false); fo.sendBaseline('USER_CREATE_ERROR',false);
log(LOG_ERROR,"New user couldn't be created (error code "+newuser+")"); log(LOG_ERROR,"New user couldn't be created (error code "+newuser+")");
return; processed = true;
return this.isComplete;
} }
newuser.security.password = ''; newuser.security.password = '';
@ -171,7 +179,8 @@ function register() {
log(LOG_INFO,"Created user record #"+user.number+": "+user.alias); log(LOG_INFO,"Created user record #"+user.number+": "+user.alias);
action = ACTION_EXIT; action = ACTION_EXIT;
return; processed = true;
return this.isComplete;
} else { } else {
fo.sendBaseline('LOGIN_ERROR',false); fo.sendBaseline('LOGIN_ERROR',false);
@ -179,11 +188,10 @@ function register() {
user.comment = 'Initial login failed!'; user.comment = 'Initial login failed!';
newuser.settings |= USER_DELETED; newuser.settings |= USER_DELETED;
delete newuser; delete newuser;
processed = true;
return; return this.isComplete;
} }
return 'processed';
} }
} }

View File

@ -661,8 +661,10 @@ while(bbs.online) {
default: default:
// Its assumed that you get here after completing a form and you have pressed 1 to submit that form. // Its assumed that you get here after completing a form and you have pressed 1 to submit that form.
log(LOG_DEBUG,' ! EVAL method:'+JSON.stringify(fo.key)); log(LOG_DEBUG,' ! EVAL method:'+JSON.stringify(fo.key));
var x = cc.process(); if (cc.process()) {
log(LOG_DEBUG,' = EVAL method:'+JSON.stringify(x)); control.pop();
log(LOG_DEBUG,' = Process Completed.');
}
} }
/* /*