diff options
Diffstat (limited to 'modules/main.inc.php')
-rw-r--r-- | modules/main.inc.php | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/modules/main.inc.php b/modules/main.inc.php index db62096..6119814 100644 --- a/modules/main.inc.php +++ b/modules/main.inc.php @@ -62,22 +62,23 @@ class Page_Main extends Page { $data = User::getData(); $data['organization'] = User::getOrganizationName(); - // Shoe testacc merge form if organization has test accounts - $res = Database::queryFirst('SELECT Count(*) as cnt FROM user WHERE organizationid = :oid', array( + // Show testacc merge form if organization has test accounts + $res = Database::queryFirst('SELECT Count(*) as cnt FROM user WHERE organizationid = :oid AND Length(password) <> 0', array( 'oid' => User::getOrganizationId() )); - if ($res !== false && $res['cnt'] > 0) { - $data['testacc'] = true; - $mail = trim(User::getMail()); - if (!empty($mail)) { - $existing = Database::queryFirst('SELECT userid FROM user WHERE email = :email LIMIT 1', array( - 'email' => $mail - )); - if ($existing !== false) { - $data['testlogin'] = $existing['userid']; - } + $mail = trim(User::getMail()); + if (!empty($mail)) { + $existing = Database::queryFirst('SELECT userid FROM user + WHERE email = :email AND lastname = :ln AND firstname = :fn LIMIT 1', array( + 'email' => $mail, + 'fn' => User::getFirstName(), + 'ln' => User::getLastName(), + )); + if ($existing !== false) { + $data['testlogin'] = $existing['userid']; } } + $data['testacc'] = ($res !== false && $res['cnt'] > 0) || !empty($existing); $data['suite'] = CONFIG_SUITE; $data['idm'] = CONFIG_IDM; Render::addTemplate('main/deploy', $data); |