1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,67 @@ |
1 |
+<?php |
|
2 |
+/** |
|
3 |
+ * Copyright (C) 2021 Double Bastion LLC |
|
4 |
+ * |
|
5 |
+ * This file is part of Roundpin, which is licensed under the |
|
6 |
+ * GNU Affero General Public License Version 3.0. The license terms |
|
7 |
+ * are detailed in the "LICENSE.txt" file located in the root directory. |
|
8 |
+ */ |
|
9 |
+ |
|
10 |
+$retrievedToken = $_GET['token']; |
|
11 |
+ |
|
12 |
+if (($retrievedToken != '') && (strlen($retrievedToken) == 55)) { |
|
13 |
+ |
|
14 |
+ define('ACCESSCONST', TRUE); |
|
15 |
+ |
|
16 |
+ require('db-connect.php'); |
|
17 |
+ |
|
18 |
+ // Find the user who has a token identical with the one retrieved from the link that has been clicked |
|
19 |
+ $registered = 0; |
|
20 |
+ $enabled = 1; |
|
21 |
+ $query0 = $mysqli->prepare("SELECT id, username, emailaddress, registered, token, temporarypass, enabled FROM app_users WHERE registered=? AND token=? AND enabled=?"); |
|
22 |
+ $query0->bind_param("isi", $registered, $retrievedToken, $enabled); |
|
23 |
+ $query0->execute(); |
|
24 |
+ $fetchedrow = $query0->get_result()->fetch_assoc(); |
|
25 |
+ |
|
26 |
+ if (!$fetchedrow) { |
|
27 |
+ exit("Error !"); |
|
28 |
+ } else { |
|
29 |
+ $userID = $fetchedrow['id']; |
|
30 |
+ $userName = $fetchedrow['username']; |
|
31 |
+ $tempPassword = $fetchedrow['temporarypass']; |
|
32 |
+ $useremail = $fetchedrow['emailaddress']; |
|
33 |
+ |
|
34 |
+ $query1 = $mysqli->query("UPDATE app_users SET registered = '1', token = '', temporarypass = '' WHERE id = '$userID'"); |
|
35 |
+ |
|
36 |
+ header("Location: new-email-message.php"); |
|
37 |
+ |
|
38 |
+ // Send the new email |
|
39 |
+ |
|
40 |
+ $domaininit = explode(".", $_SERVER['HTTP_HOST']); |
|
41 |
+ array_shift($domaininit); |
|
42 |
+ $domain = implode(".", $domaininit); |
|
43 |
+ $reqHost = $_SERVER['HTTP_HOST']; |
|
44 |
+ |
|
45 |
+ // Mention the content-type, since it's an HTML email |
|
46 |
+ $headers = "MIME-Version: 1.0" . "\r\n"; |
|
47 |
+ $headers .= "Content-type: text/html; charset=UTF-8" . "\r\n"; |
|
48 |
+ $headers .= "From: " . "no-reply@" . $domain . "\r\n"; |
|
49 |
+ |
|
50 |
+ $subject = "Roundpin account access"; |
|
51 |
+ |
|
52 |
+ $message = "Hello, <br><br> |
|
53 |
+ You can log in to your Roundpin account using the following credentials:<br><br> |
|
54 |
+ username: <b>".$userName."</b><br> |
|
55 |
+ password: <b>".$tempPassword."</b><br><br> |
|
56 |
+ We highly recommend to change the password provided in this email with a new strong password. After you log in to Roundpin, click on the 'Account Settings' |
|
57 |
+ wheel, click on 'Configure Account', then click on the 'Change Password' tab; enter your current password and a new password of at least 10 characters, |
|
58 |
+ containing at least one letter, one digit and one special character.<br><br> |
|
59 |
+ Thank you,<br> |
|
60 |
+ Roundpin<br> |
|
61 |
+ Host: '" . $reqHost . "'"; |
|
62 |
+ |
|
63 |
+ mail($useremail, $subject, $message, $headers); |
|
64 |
+ } |
|
65 |
+} |
|
66 |
+ |
|
67 |
+?> |