Commit 1d6f8211 authored by Ruslan Kabalin's avatar Ruslan Kabalin
Browse files

Added "decline" link to profile verification email to pervent someone's email


 address locking (bug #490629).
Signed-off-by: default avatarRuslan Kabalin <ruslan.kabalin@luns.net.uk>
Signed-off-by: default avatarFrancois Marier <francois@catalyst.net.nz>
parent 242606f6
......@@ -270,6 +270,7 @@ function profileform_submit(Pieform $form, $values) {
$key = get_random_key();
$key_url = get_config('wwwroot') . 'artefact/internal/validate.php?email=' . rawurlencode($email) . '&key=' . $key;
$key_url_decline = $key_url . '&decline=1';
try {
email_user(
......@@ -285,7 +286,7 @@ function profileform_submit(Pieform $form, $values) {
),
null,
get_string('emailvalidation_subject', 'artefact.internal'),
get_string('emailvalidation_body', 'artefact.internal', $USER->get('firstname'), $email, $key_url)
get_string('emailvalidation_body', 'artefact.internal', $USER->get('firstname'), $email, $key_url, $key_url_decline)
);
}
catch (EmailException $e) {
......
......@@ -90,7 +90,11 @@ $string['emailvalidation_subject'] = 'Email validation';
$string['emailvalidation_body'] = <<<EOF
Hello %s,
The email address %s has been added to your user account in Mahara. Please visit the link below to activate this address.
You have added email address %s to your user account in Mahara. Please visit the link below to activate this address.
%s
If this email belongs to you but you have not requested adding it to your Mahara account, follow the link below to decline email activation.
%s
EOF;
......@@ -101,6 +105,7 @@ $string['emailactivation'] = 'Email Activation';
$string['emailactivationsucceeded'] = 'Email Activation Successful';
$string['emailalreadyactivated'] = 'Email already activiated';
$string['emailactivationfailed'] = 'Email Activation Failed';
$string['emailactivationdeclined'] = 'Email Activation Declined Successfully';
$string['verificationlinkexpired'] = 'Verification link expired';
$string['invalidemailaddress'] = 'Invalid email address';
$string['unvalidatedemailalreadytaken'] = 'The e-mail address you are trying to validate is already taken';
......
......@@ -37,10 +37,16 @@ define('TITLE', get_string('emailactivation','artefact.internal'));
$email = param_variable('email');
$key = param_variable('key');
$decline = param_boolean('decline');
$row = get_record('artefact_internal_profile_email', 'email', $email, 'key', $key, null,null,'owner,artefact,email,verified,' . db_format_tsfield('expiry'));
if ($row) {
if ($decline) {
delete_records_select('artefact_internal_profile_email', 'verified=0 AND key=? AND email=?', array($key, $email));
$SESSION->add_ok_msg(get_string('emailactivationdeclined', 'artefact.internal'));
redirect(get_config('wwwroot'));
}
if ($row->expiry > time()) {
if ($row->artefact) {
$artefact = new ArtefactTypeEmail($row->artefact);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment