-} elseif (isFormSent()) {
- // Try the login (see inc/libs/user_functions.php)
- $url = doUserLogin(postRequestParameter('id'), postRequestParameter('password'));
-} elseif ((isPostRequestParameterSet('new_pass')) && (isset($userid))) {
+} elseif (isFormSent('login')) {
+ // Are both 'id' and 'password' set?
+ if ((isPostRequestElementSet('id')) && (isPostRequestElementSet('password'))) {
+ // Try the login (see inc/libs/user_functions.php)
+ $url = doUserLogin(postRequestElement('id'), postRequestElement('password'));
+ } elseif (!isPostRequestElementSet('id')) {
+ // Empty 'id'
+ $errorCode = getCode('LOGIN_EMPTY_ID');
+ } else {
+ // Empty 'password'
+ $errorCode = getCode('LOGIN_EMPTY_PASSWORD');
+ }
+} elseif ((isPostRequestElementSet('new_pass')) && (!empty($userid))) {