3 set_include_path(get_include_path() . PATH_SEPARATOR
. '../lib');
5 include_once("aur.inc.php"); # access AUR common functions
7 set_lang(); # this sets up the visitor's language
8 check_sid(); # see if they're still logged in
10 if (isset($_COOKIE["AURSID"])) {
11 header('Location: index.php');
17 if (isset($_GET['resetkey'], $_POST['email'], $_POST['password'], $_POST['confirm'])) {
18 $resetkey = $_GET['resetkey'];
19 $email = $_POST['email'];
20 $password = $_POST['password'];
21 $confirm = $_POST['confirm'];
22 $uid = uid_from_email($email);
24 if (empty($email) ||
empty($password)) {
25 $error = __('Missing a required field.');
26 } elseif ($password != $confirm) {
27 $error = __('Password fields do not match.');
28 } elseif ($uid == NULL ||
$uid == 'None') {
29 $error = __('Invalid e-mail.');
33 $salt = generate_salt();
34 $hash = salted_hash($password, $salt);
36 $error = password_reset($hash, $salt, $resetkey, $email);
38 } elseif (isset($_POST['email'])) {
39 $email = $_POST['email'];
40 $uid = uid_from_email($email);
41 if ($uid != NULL && $uid != 'None') {
42 # We (ab)use new_sid() to get a random 32 characters long string
43 $resetkey = new_sid();
44 create_resetkey($resetkey, $uid);
45 # Send email with confirmation link
46 $body = __('A password reset request was submitted for the account '.
47 'associated with your e-mail address. If you wish to reset '.
48 'your password follow the link below, otherwise ignore '.
49 'this message and nothing will happen.').
51 "{$AUR_LOCATION}/passreset.php?".
52 "resetkey={$resetkey}";
53 $body = wordwrap($body, 70);
54 $headers = "Reply-to: nobody@archlinux.org\nFrom:aur-notify@archlinux.org\nX-Mailer: PHP\nX-MimeOLE: Produced By AUR";
55 @mail
($email, 'AUR Password Reset', $body, $headers);
58 header('Location: passreset.php?step=confirm');
62 $step = isset($_GET['step']) ?
$_GET['step'] : NULL;
64 html_header(__("Password Reset"));
69 <h2
><?php
print __("Password Reset"); ?
></h2
>
72 <p
><span
class="error"><?php
echo $error ?
></span
></p
>
75 if ($step == 'confirm') {
76 echo __('Check your e-mail for the confirmation link.');
77 } elseif ($step == 'complete') {
78 echo __('Your password has been reset successfully.');
79 } elseif (isset($_GET['resetkey'])) {
81 <form action
="" method
="post">
84 <td
><?php
echo __("Confirm your e-mail address:"); ?
></td
>
85 <td
><input type
="text" name
="email" size
="30" maxlength
="64" /></td
>
88 <td
><?php
echo __("Enter your new password:"); ?
></td
>
89 <td
><input type
="password" name
="password" size
="30" maxlength
="32" /></td
>
92 <td
><?php
echo __("Confirm your new password:"); ?
></td
>
93 <td
><input type
="password" name
="confirm" size
="30" maxlength
="32" /></td
>
97 <input type
="submit" class="button" value
="<?php echo __('Continue') ?>" />
102 <p
><?php
echo __('If you have forgotten the e-mail address you used to register, please send a message to the %saur-general%s mailing list.',
103 '<a href="http://mailman.archlinux.org/mailman/listinfo/aur-general">',
105 <form action
="" method
="post">
106 <p
><?php
echo __("Enter your e-mail address:"); ?
>
107 <input type
="text" name
="email" size
="30" maxlength
="64" /></p
>
108 <input type
="submit" class="button" value
="<?php echo __('Continue') ?>" />
115 html_footer(AUR_VERSION
);