mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
This works by adding a new field to the 'Users' table called 'ResetKey', which is a 32 characters long, random string. When the user requests a password reset, a new 'reset key' is generated and sent to the user's e-mail address in the form of a link in the following format: http://aur.archlinux.org/passreset.php?resetkey=<reset key> When the above link is followed, the user is presented with a form to verify his/her e-mail address and specify the new desired password. If the e-mail address matches the reset key in the database, the new password is assigned to the account. If there is an error, a relevant message is displayed and the user is prompted to re-enter the required information. Upon successful completion of this procedure, the ResetKey field in the database is blanked and the specific key cannot be reused. One SQL query is needed to add the ResetKey field to the 'Users' table: ALTER TABLE `Users` ADD `ResetKey` CHAR(32) NOT NULL DEFAULT ''; Signed-off-by: Loui Chang <louipc.ist@gmail.com>
30 lines
1,023 B
PHP
30 lines
1,023 B
PHP
<div id="login_bar">
|
|
<?php
|
|
if (isset($_COOKIE["AURSID"])) {
|
|
print __("Logged-in as: %s", '<b>' . username_from_sid($_COOKIE["AURSID"]) . '</b>');
|
|
?>
|
|
<a href="logout.php">[<?php print __("Logout"); ?>]</a>
|
|
<?php
|
|
}
|
|
else {
|
|
if ($login_error) {
|
|
print "<span class='error'>" . $login_error . "</span><br />\n";
|
|
}
|
|
'?' . implode('&', $_GET);
|
|
?>
|
|
<form method="post" action="<?php echo $_SERVER['REQUEST_URI'] ?>">
|
|
<div>
|
|
<?php print __('Username') . ':'; ?>
|
|
<input type="text" name="user" size="30" maxlength="<?php print USERNAME_MAX_LEN; ?>" value="<?php
|
|
if (isset($_POST['user'])) {
|
|
print htmlspecialchars($_POST['user'], ENT_QUOTES);
|
|
} ?>" />
|
|
<?php print __('Password') . ':'; ?>
|
|
<input type="password" name="passwd" size="30" maxlength="<?php print PASSWD_MAX_LEN; ?>" />
|
|
<input type="checkbox" name="remember_me" /><?php print __("Remember me"); ?>
|
|
<input type="submit" class="button" value="<?php print __("Login"); ?>" />
|
|
</div>
|
|
</form>
|
|
<a href="passreset.php">[Forgot Password]</a>
|
|
<?php } ?>
|
|
</div>
|