summaryrefslogtreecommitdiffstats
path: root/web/html
diff options
context:
space:
mode:
authorLukas Fleischer <archlinux@cryptocrack.de>2013-03-19 13:10:12 +0100
committerLukas Fleischer <archlinux@cryptocrack.de>2013-03-19 14:03:33 +0100
commit5d31bb24502536d53968f1ba0062d2b0aedb11c5 (patch)
treed30a2a0b49af116ac839000bd2cf354db62bfcca /web/html
parenta386bbd35d20465ae182b7aadf3fd2dfcbd5250f (diff)
downloadaur-5d31bb24502536d53968f1ba0062d2b0aedb11c5.tar.gz
aur-5d31bb24502536d53968f1ba0062d2b0aedb11c5.tar.xz
Move reset key submission to a separate function
This allows for reusing reset key submission for other things, such as sending an initial password reset code during account registration. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Diffstat (limited to 'web/html')
-rw-r--r--web/html/passreset.php22
1 files changed, 5 insertions, 17 deletions
diff --git a/web/html/passreset.php b/web/html/passreset.php
index 064e3de6..94a1ad98 100644
--- a/web/html/passreset.php
+++ b/web/html/passreset.php
@@ -37,24 +37,12 @@ if (isset($_GET['resetkey'], $_POST['email'], $_POST['password'], $_POST['confir
}
} elseif (isset($_POST['email'])) {
$email = $_POST['email'];
- $uid = uid_from_email($email);
- if ($uid != NULL && $uid != 'None') {
- # We (ab)use new_sid() to get a random 32 characters long string
- $resetkey = new_sid();
- create_resetkey($resetkey, $uid);
- # Send email with confirmation link
- $body = __('A password reset request was submitted for the account '.
- 'associated with your e-mail address. If you wish to reset '.
- 'your password follow the link below, otherwise ignore '.
- 'this message and nothing will happen.').
- "\n\n".
- "{$AUR_LOCATION}/" . get_uri('/passreset/') . "?".
- "resetkey={$resetkey}";
- $body = wordwrap($body, 70);
- $headers = "Reply-to: nobody@archlinux.org\nFrom:aur-notify@archlinux.org\nX-Mailer: PHP\nX-MimeOLE: Produced By AUR";
- @mail($email, 'AUR Password Reset', $body, $headers);
+ $body = __('A password reset request was submitted for the account '.
+ 'associated with your e-mail address. If you wish to reset '.
+ 'your password follow the link below, otherwise ignore '.
+ 'this message and nothing will happen.').
+ send_resetkey($email, $body);
- }
header('Location: ' . get_uri('/passreset/') . '?step=confirm');
exit();
}