diff --git a/load/control-register.js b/load/control-register.js index 92a7a89..6ea7980 100644 --- a/load/control-register.js +++ b/load/control-register.js @@ -20,6 +20,7 @@ log(LOG_DEBUG,'+ Control REGISTER loaded'); function register() { var code = ''; var complete = false; + var processed = false; // Called before processing for a field Object.defineProperty(this, 'getName', { @@ -30,7 +31,7 @@ function register() { Object.defineProperty(this, 'isComplete', { get: function () { - return complete; + return complete && processed; } }); @@ -42,6 +43,11 @@ function register() { } 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)+')'); if ((cf.fname === 'TOKEN') && (read === '#' || read === "\r")) { @@ -146,13 +152,15 @@ function register() { fo.sendBaseline('USER_EXISTS',false); log(LOG_ERROR,"New user couldn't be created (user created while signing up)"); log(LOG_ERROR,JSON.stringify(e)); - return; + processed = true; + return this.isComplete; } if (typeof newuser === 'number') { fo.sendBaseline('USER_CREATE_ERROR',false); log(LOG_ERROR,"New user couldn't be created (error code "+newuser+")"); - return; + processed = true; + return this.isComplete; } newuser.security.password = ''; @@ -171,7 +179,8 @@ function register() { log(LOG_INFO,"Created user record #"+user.number+": "+user.alias); action = ACTION_EXIT; - return; + processed = true; + return this.isComplete; } else { fo.sendBaseline('LOGIN_ERROR',false); @@ -179,11 +188,10 @@ function register() { user.comment = 'Initial login failed!'; newuser.settings |= USER_DELETED; delete newuser; + processed = true; - return; + return this.isComplete; } - - return 'processed'; } } diff --git a/main.js b/main.js index 9347bbd..1134a08 100644 --- a/main.js +++ b/main.js @@ -661,8 +661,10 @@ while(bbs.online) { default: // 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)); - var x = cc.process(); - log(LOG_DEBUG,' = EVAL method:'+JSON.stringify(x)); + if (cc.process()) { + control.pop(); + log(LOG_DEBUG,' = Process Completed.'); + } } /*