summaryrefslogtreecommitdiffstats
path: root/modules/main.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2019-10-14 14:05:34 +0200
committerSimon Rettberg2019-10-14 14:05:34 +0200
commit1d344bdc70d61939f0a505960e87fd18ea8c8d54 (patch)
tree333f2a494b3779a139dee511d13f5a9857b9b56e /modules/main.inc.php
parentNein, nicht cool (diff)
downloadbwlp-webadmin-1d344bdc70d61939f0a505960e87fd18ea8c8d54.tar.gz
bwlp-webadmin-1d344bdc70d61939f0a505960e87fd18ea8c8d54.tar.xz
bwlp-webadmin-1d344bdc70d61939f0a505960e87fd18ea8c8d54.zip
Refine old/test account merging logic
Diffstat (limited to 'modules/main.inc.php')
-rw-r--r--modules/main.inc.php25
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);