Commit graph

32 commits

Author SHA1 Message Date
Lukas Fleischer
ee2aa9755f Add support for backup email addresses
Support secondary email addresses that can be used to recover an account
in case access to the primary email address is lost. Reset keys for an
account are always sent to both the primary and the backup email
address.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2020-02-02 12:12:42 +01:00
Lukas Fleischer
e5a839bf0b Add option to send reset key for a given user name
In addition to supporting email addresses in the reset key form, also
support user names. The reset key is then sent to the email address in
the user's profile.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2020-02-02 12:12:42 +01:00
Lukas Fleischer
6892ec7791 Call check_sid() from a central location
Instead of calling check_sid() from every single PHP script representing
a web page, add the call to aur.inc.php which is sourced by all of them.

Also, remove set_lang() calls from the scripts since these are also
already included in aur.inc.php.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-04-27 09:22:53 +02:00
Lukas Fleischer
29a48708bb Use bcrypt to hash passwords
Replace the default hash function used for storing passwords by
password_hash() which internally uses bcrypt. Legacy MD5 hashes are
still supported and are immediately converted to the new format when a
user logs in.

Since big parts of the authentication system needed to be rewritten in
this context, this patch also includes some simplification and
refactoring of all code related to password checking and resetting.

Fixes FS#52297.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-02-24 22:04:49 +01:00
Lukas Fleischer
9746a65473 Port notification routines to Python
Use a Python script for sending notification emails. The notification
action and additional parameters are passed via command line arguments.
For comment and package request notifications, the text is passed via
stdin.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-08-08 12:59:23 +02:00
Lukas Fleischer
40461eb738 Include user name in password reset emails
Fixes FS#44320.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-05-22 22:32:43 +02:00
Lukas Fleischer
75923205af Fix email body of password reset emails
When the password reset function was factored out in 5d31bb2 (Move reset
key submission to a separate function, 2013-03-19), a semicolon was
accidentally replaced by a concatenation operator. As a result of this,
all password reset emails sent since mid-2013 only contained a password
reset link without any description. Fix this by terminating the
assignment with a semicolon again.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-05-21 09:33:58 +02:00
Lukas Fleischer
cc1e8aed30 Rename the AUR software to aurweb
Rename the project to help differentiate between the software providing
access to the Arch User Repository and the collection of source packages
itself.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2015-02-04 09:50:01 +01:00
Lukas Fleischer
888b8d471f Check password length on the password reset form
We already check for a minimum password length on the account edit page.
Add the same check to the password reset form (which is also used to set
an initial password).

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-11-21 11:43:31 +01:00
Lukas Fleischer
0a66f48aa1 Do not return "None" in user functions
Return null instead of the string "None" in username_from_id(),
uid_from_email() and uid_from_username().

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-06-05 15:12:10 +02:00
Lukas Fleischer
02e7df7631 Be friendly to newly registered users
Use "Welcome to the Arch User Repository" instead of "AUR Password
Reset" as subject for the initial password reset email.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-05-22 15:43:41 +02:00
Lukas Fleischer
1be6761acd passreset.php: Make error messages translatable
This fixes a regression introduced in commit 48b7407 (passreset.php:
Refactor HTML, 2014-01-08).

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-02-10 22:20:47 +01:00
Lukas Fleischer
cc490ce8d6 passreset.php: Error out if e-mail is empty
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-01-11 12:08:24 +01:00
Lukas Fleischer
48b74071f0 passreset.php: Refactor HTML
* Use the "errorlist" class for errors.
* Refactor some code.
* Properly display error messages when requesting a key.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-01-11 12:08:24 +01:00
Lukas Fleischer
5d31bb2450 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>
2013-03-19 14:03:33 +01:00
Dan McGee
5222bf0932 Use HTTPS links everywhere for Arch sites
The main site, wiki, and BBS are using HTTPS exclusively, so link
directly to the correct protocol rather than forcing a redirect.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-10-22 12:33:11 +02:00
canyonknight
24a8452880 Remove character limit on password length
As all new passwords are hashed and therefore stored in the database
at the same length, this limitation is no longer needed.

Fixes FS#31855

Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-10-11 21:19:16 +02:00
Lukas Fleischer
6102759b7c Use echo shortcut syntax
Replace all occurrences of "<?php echo" and "<?php print" by "<?=" to
reduce noise in templates.

Note that as of PHP 5.4.0, "<?=" is always available and no longer
requires "short_open_tag" to be set.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-09-24 12:23:04 +02:00
Lukas Fleischer
2425f963f8 Use virtual path feature for links
Use virtual paths in links (e.g. link to "/packages/" instead of
"/packages.php" etc.) if the virtual path feature is enabled.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-07-15 22:44:51 +02:00
canyonknight
82d234c4d5 passreset.php: Pull out DB code
* Move DB code in passreset.php to new functions in acctfuncs.inc.php
* Centralization of DB code important in a future transition to PDO interface

Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-07-06 11:27:00 +02:00
canyonknight
2d53cdd4d5 passreset.php: Overhaul to match archweb
* Switch to CSS used by archweb
* General fixups in XHTML

Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-07-06 11:26:36 +02:00
Lukas Fleischer
f90d569376 Remove all traces of "pgboxtitle"
Using a div container to format heading is ridiculous. Use "<h2></h2>"
instead.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Signed-off-by: canyonknight <canyonknight@gmail.com>
2012-07-06 11:25:58 +02:00
Lukas Fleischer
f5e1652bf9 Always set the "To:" header when sending mail
Use "undisclosed-recipients: ;" when sending mass notifications (such as
comment notifications and the like. Addresses FS#28229.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2012-03-08 11:43:48 +01:00
Dan McGee
e571a694d6 Add a new AUR_LOCATION setting
This should be set to something like 'http://localhost' for development
or 'https://aur.archlinux.org' in production. It ensures all links in
the site stay in the development site and there is no sudden jump from
development to production environments.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-11-02 21:21:23 +01:00
Lukas Fleischer
323d418f02 Wrap mysql_real_escape_string() in a function
Wrap mysql_real_escape_string() in a wrapper function db_escape_string()
to ease porting to other databases, and as another step to pulling more
of the database code into a central location.

This is a rebased version of a patch by elij submitted about half a year
ago.

Thanks-to: elij <elij.mx@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-10-24 17:57:54 +02:00
Lukas Fleischer
ee4b398033 Use "%s" instead of "%h" in format strings
Use the standard string type specifier instead of "%h" in format
strings. Both specifiers are treated equally in __() so we shouldn't
break anything here. This also allows us to replace the hacky
substitution algorithm in __() by vsprintf().

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-08-20 20:28:47 +02:00
elij
888db089c5 rename *.inc files to *.inc.php and adjust imports and references
Lukas: Add note to "UPGRADING".

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-06-22 15:15:04 +02:00
Dan McGee
3609cf140e SQL: treat all UID/ID values as numbers, not strings
Ensure we are not quoting these values in any of our SQL queries.

Thanks-to: elij <elij.mx@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-04-27 14:50:27 +02:00
Lukas Fleischer
5ea9fc197d Use HTTPs for links in password reset confirmation mails.
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2011-04-19 23:59:19 +02:00
Loui Chang
d13f2af079 Modify some strings for translation.
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
2010-10-07 23:07:01 -04:00
Denis
290c436046 Support for storing salted passwords
To upgrade existing databases:

ALTER TABLE Users ADD Salt CHAR(32) NOT NULL DEFAULT '';

Signed-off-by: Loui Chang <louipc.ist@gmail.com>
2010-04-17 16:50:24 -04:00
Evangelos Foutras
861cbf4935 Implement 'Password Reset' facility (FS#3061)
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>
2009-11-13 16:49:55 -05:00