mirror of
https://github.com/Znote/ZnoteAAC.git
synced 2025-04-29 10:49:23 +02:00
Possibility to reward users with shop points if they verify their email
Also generates a new activation key after they have verified their email in-case they change their email and guess the activation link for their fake email. Also removes the given points until they verify their email again if they change their email.
This commit is contained in:
parent
d8f22f9c33
commit
be8b882166
@ -692,6 +692,7 @@
|
||||
'register' => false, // Send activation mail
|
||||
'accountRecovery' => false, // Recover username or password through mail
|
||||
'myaccount_verify_email' => false, // Allow user to verify their email in myaccount page
|
||||
'verify_email_points' => 0, // 0 = disabled. Give users points reward for verifying their email
|
||||
'host' => "mailserver.znote.eu", // Outgoing mail server host.
|
||||
'securityType' => 'ssl', // ssl or tls
|
||||
'port' => 465, // SMTP port number - likely to be 465(ssl) or 587(tls)
|
||||
|
@ -30,11 +30,16 @@ if (isset($_GET['authenticate']) && $config['mailserver']['myaccount_verify_emai
|
||||
$user = (int) $user['id'];
|
||||
$active = (int) $user['active'];
|
||||
$active_email = (int) $user['active_email'];
|
||||
$verify_points = ($active_email == 0 && $config['mailserver']['verify_email_points'] > 0)
|
||||
? ", `points` = `points` + {$config['mailserver']['verify_email_points']}"
|
||||
: '';
|
||||
// Enable the account to login
|
||||
if ($active == 0 || $active_email == 0) {
|
||||
mysql_update("UPDATE `znote_accounts` SET `active`='1', `active_email`='1' WHERE `id`= $user LIMIT 1;");
|
||||
$new_activeKey = rand(100000000,999999999);
|
||||
mysql_update("UPDATE `znote_accounts` SET `active`='1', `active_email`='1', `activekey`='{$new_activeKey}' {$verify_points} WHERE `id`= {$user} LIMIT 1;");
|
||||
}
|
||||
echo '<h1>Congratulations!</h1> <p>Your email has been verified.</p>';
|
||||
if ($verify_points !== '') echo "<p>As thanks for having a verified email, you have received <a href='/shop.php'>{$config['mailserver']['verify_email_points']} shop points</a>!</p>";
|
||||
$user_znote_data['active_email'] = 1;
|
||||
// Todo: Bonus points as thanks for verifying email
|
||||
} else {
|
||||
|
@ -43,6 +43,11 @@ if (isset($_GET['success']) === true && empty($_GET['success']) === true) {
|
||||
'active_email' => '0'
|
||||
);
|
||||
|
||||
// If he had previously verified his email address, remove the previously aquired bonus points
|
||||
if ($user_znote_data['active_email'] > 0) {
|
||||
$update_znote_data['points'] = $user_znote_data['points'] - $config['mailserver']['verify_email_points'];
|
||||
}
|
||||
|
||||
user_update_account($update_data);
|
||||
user_update_znote_account($update_znote_data);
|
||||
header('Location: settings.php?success');
|
||||
|
Loading…
x
Reference in New Issue
Block a user