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: /');
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 (!good_passwd($password)) {
29 $length_min = config_get_int('options', 'passwd_min_len');
30 $error = __("Your password must be at least %s characters.",
32 } elseif ($uid == null) {
33 $error = __('Invalid e-mail.');
37 $salt = generate_salt();
38 $hash = salted_hash($password, $salt);
40 $error = password_reset($hash, $salt, $resetkey, $email);
42 } elseif (isset($_POST['email'])) {
43 $email = $_POST['email'];
44 $username = username_from_id(uid_from_email($email));
47 $error = __('Missing a required field.');
49 $subject = 'AUR Password Reset';
50 $body = __('A password reset request was submitted for the ' .
51 'account %s associated with your e-mail address. ' .
52 'If you wish to reset your password follow the ' .
53 'link below, otherwise ignore this message and ' .
54 'nothing will happen.', $username);
55 send_resetkey($email, $subject, $body);
57 header('Location: ' . get_uri('/passreset/') . '?step=confirm');
62 $step = isset($_GET['step']) ?
$_GET['step'] : NULL;
64 html_header(__("Password Reset"));
69 <h2
><?
= __("Password Reset"); ?
></h2
>
71 <?php
if ($step == 'confirm'): ?
>
72 <p
><?
= __('Check your e-mail for the confirmation link.') ?
></p
>
73 <?php
elseif ($step == 'complete'): ?
>
74 <p
><?
= __('Your password has been reset successfully.') ?
></p
>
75 <?php
elseif (isset($_GET['resetkey'])): ?
>
77 <ul
class="errorlist"><li
><?
= $error ?
></li
></ul
>
79 <form action
="" method
="post">
82 <td
><?
= __("Confirm your e-mail address:"); ?
></td
>
83 <td
><input type
="text" name
="email" size
="30" maxlength
="64" /></td
>
86 <td
><?
= __("Enter your new password:"); ?
></td
>
87 <td
><input type
="password" name
="password" size
="30" /></td
>
90 <td
><?
= __("Confirm your new password:"); ?
></td
>
91 <td
><input type
="password" name
="confirm" size
="30" /></td
>
95 <input type
="submit" class="button" value
="<?= __('Continue') ?>" />
98 <p
><?
= __('If you have forgotten the e-mail address you used to register, please send a message to the %saur-general%s mailing list.',
99 '<a href="https://mailman.archlinux.org/mailman/listinfo/aur-general">',
101 <?php
if ($error): ?
>
102 <ul
class="errorlist"><li
><?
= $error ?
></li
></ul
>
104 <form action
="" method
="post">
105 <p
><?
= __("Enter your e-mail address:"); ?
>
106 <input type
="text" name
="email" size
="30" maxlength
="64" /></p
>
107 <input type
="submit" class="button" value
="<?= __('Continue') ?>" />
114 html_footer(AURWEB_VERSION
);