Skip to content

[login] Improve request account email #9802

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions modules/login/php/signup.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -143,19 +143,18 @@ class Signup extends \NDB_Page implements ETagCalculator
}

// Check email address' uniqueness
$result = $DB->pselectOne(
$result = $DB->pselectOne(
"SELECT COUNT(*) FROM users WHERE Email=:VEmail OR UserID=:VEmail",
['VEmail' => $from]
);

$siteList = \Utility::getSiteList();
if ($result == 0) {
// insert into DB only if email address doesn't exist
$DB->insert('users', $vals);
// Get the ID of the new user and insert into user_psc_rel
$user_id = $DB->getLastInsertId();

// verify site exists
$siteList = \Utility::getSiteList();
if (!is_null($site) && array_key_exists($site, $siteList)) {
$DB->insert(
'user_psc_rel',
Expand Down Expand Up @@ -248,15 +247,17 @@ class Signup extends \NDB_Page implements ETagCalculator
// Send email to users with User Management permissions.
$config = \NDB_Factory::singleton()->config();
$studyName = $config->getSetting('title');

$baseURL = \NDB_Factory::singleton()->settings()->getBaseURL();
\Email::send(
$row['Email'],
'request_account.tpl',
[
'Study' => $studyName,
'UserID' => $from,
'Site' => $siteList[$site],
'Real_name' => $fullname,
'Email' => $from,
'URL' => $baseURL
. "/user_accounts/?pendingApproval=Y",
]
);
}
Expand Down
13 changes: 6 additions & 7 deletions smarty/templates/email/request_account.tpl
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
Subject: Account Requested for {$Study}
Subject: {$Real_name} Requested Account for {$Study}
Hi,

A user is requesting an account for the LORIS instance managed by this email.
{$Real_name} has requested an account for the LORIS instance managed by this email.

Details:

Username - {$UserID}
Name - {$Real_name}
Email - {$Email}
Site - {$Site}


This is an automated message.
In order to accept the user account request, you may go to {$URL}
This is an automated message.
Loading