summaryrefslogtreecommitdiffstats
path: root/modules/main.inc.php
diff options
context:
space:
mode:
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);