summaryrefslogtreecommitdiffstats
path: root/modules/main.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2021-01-22 10:34:42 +0100
committerSimon Rettberg2021-01-22 10:34:42 +0100
commit242b0e0a204db1dcf9ea453ec1a86618fc740ebf (patch)
tree61181b5254314909cba1a86fe1b998b0a14627d0 /modules/main.inc.php
parent[adduser] Fix malformed static method call (diff)
downloadbwlp-webadmin-242b0e0a204db1dcf9ea453ec1a86618fc740ebf.tar.gz
bwlp-webadmin-242b0e0a204db1dcf9ea453ec1a86618fc740ebf.tar.xz
bwlp-webadmin-242b0e0a204db1dcf9ea453ec1a86618fc740ebf.zip
[deploy] Improve account merging
* Make matching of name and email case insensitive * Add config option to allow/disallow merging with existing shib-account
Diffstat (limited to 'modules/main.inc.php')
-rw-r--r--modules/main.inc.php21
1 files changed, 13 insertions, 8 deletions
diff --git a/modules/main.inc.php b/modules/main.inc.php
index 6119814..95d72c1 100644
--- a/modules/main.inc.php
+++ b/modules/main.inc.php
@@ -35,6 +35,8 @@ class Page_Main extends Page
return;
}
if (!User::isTutor()) {
+ Message::addError('Sie sind kein Mitarbeiter der Einrichtung "' . User::getOrganization()
+ . '" und können daher die ' . CONFIG_SUITE . '-Suite nicht nutzen.');
return;
}
// User is not in DB, so he might want so sign up for the service - see if conditions are met
@@ -63,22 +65,25 @@ class Page_Main extends Page
$data = User::getData();
$data['organization'] = User::getOrganizationName();
// 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()
- ));
$mail = trim(User::getMail());
- if (!empty($mail)) {
+ $fn = User::getFirstName();
+ $ln = User::getLastName();
+ if (!empty($mail) && (!empty($fn) || !empty($ln))) {
+ $extra = '';
+ if (!CONFIG_ALLOW_SHIB_MERGE) {
+ $extra = ' AND password IS NOT NULL AND Length(password) <> 0 ';
+ }
$existing = Database::queryFirst('SELECT userid FROM user
- WHERE email = :email AND lastname = :ln AND firstname = :fn LIMIT 1', array(
+ WHERE email = :email AND lastname = :ln AND firstname = :fn AND organizationid = :org ' . $extra . ' LIMIT 1', array(
'email' => $mail,
- 'fn' => User::getFirstName(),
- 'ln' => User::getLastName(),
+ 'fn' => $fn,
+ 'ln' => $ln,
+ 'org' => User::getOrganizationId(),
));
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);