Commit Graph

19 Commits

Author SHA1 Message Date
Tim Orling
abef2b6a19 Refactor usage of django.conf.urls
django.conf.urls.url() was removed in Django 4.0:
https://docs.djangoproject.com/en/4.2/releases/4.0/#features-removed-in-4-0

Replace all usage with django.urls.re_path()
Replace all django.conf.urls imports with equivalent django.urls modules

Signed-off-by: Tim Orling <tim.orling@konsulko.com>
2023-10-05 20:10:09 -07:00
Meh Mbeh Ida Delphine
2314fb2811 Add SPDX license headers to layerindex-web source files
Added SPDX identifiers to all .py files except those in migrations directory.

Fixes: [YOCTO #13527]

Signed-off-by: Meh Mbeh Ida Delphine <idadelm@gmail.com>
Signed-off-by: Paul Eggleton <bluelightning@bluelightning.org>
2021-04-21 08:22:51 +12:00
Amber Elliot
2d526f9b0d Updating models and imports for Django 2.2 upgrade.
Removed all obsolete references to django.core.urlresolvers. Added the
newly required on_delete fields to foreign key relationships in models.py
and in all migrations.

Signed-off-by: Amber Elliot  <amber.n.elliot@intel.com>
Signed-off-by: Paul Eggleton <bluelightning@bluelightning.org>
2020-06-30 05:37:09 +12:00
Amber Elliot
9a9bbeb8b6 Add user security questions
Add user security questions upon registration as extra authentication
for password reset. Three unique security questions must be chosen and
answered. Answers are then stored in the database with the same hashing
algorithm as the users's password.

On password reset, users get two chances to get two out of three
security questions answered correctly. After a second failure their
account is locked and email is sent to the admin. The same template is
shown for the axes lockout. Super user cannot reset their password until
they set security questions.

Users can update their security questions or add them if they weren't
originally set (in the case of super user) in Edit Profile.

Signed-off-by: Amber Elliot <amber.n.elliot@intel.com>
2019-07-17 11:30:56 +12:00
Amber Elliot
0f3b3e42a6 Upgrade django-registration to version 3.0.
This involves changing how registration templates are referenced
and how the activation email is sent on user's email address change.

Signed-off-by: Amber Elliot <amber.n.elliot@intel.com>
2019-07-17 11:30:56 +12:00
Paul Eggleton
e7e43ce03b Require re-registration if user changes email address
If a user goes to Edit Profile and changes their email address,
deactivate their account temporarily and make them go through the
registration process to confirm that the new email address is in fact
valid and theirs.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-11-19 16:44:39 +13:00
Paul Eggleton
2c8f979f9c Implement "delete account" function
Make it possible for users to delete their own account and all associated
information from the database, should they decide they no longer wish to
use it.

(I checked the implications of doing this on our model structure -
anything with a foreign key to user is safe to delete with the exception
of RRS MaintenancePlan.admin which I needed to change on_delete for so
that it doesn't get deleted with the user).

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-11-06 11:31:57 +13:00
Paul Eggleton
23194fc5d4 Add CAPTCHA to registration/password reset forms
Extend and override the default views so we can extend and override the
default forms to add a CAPTCHA field. This should prevent the automated
account creation requests we've been seeing on layers.openembedded.org
(luckily failing anyway due to bad domain names), but in any case this
also improves security by making it harder to do user enumeration.

For the registration page in particular, because Django's forms logic
tries to be helpful by showing all errors at once, we need to change it
so that if there's an error for the CAPTCHA then you only see that error
and no other - in particular you won't see "that username already
exists" if that is the case.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-11-06 11:31:07 +13:00
Paul Eggleton
3a040fc67b layerindex: Add support for rrs in settings.py and urls.py
Add RRS-specific settings and bring in RRS. Based on work by
Aníbal Limón <anibal.limon@linux.intel.com>.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-05-04 23:57:51 +12:00
Paul Eggleton
5cf6ef57b7 urls*: Use new urlpatterns list syntax
The patterns() function is deprecated in Django 1.8 and gone in 1.10, so
we should switch over to the new list format.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2018-04-24 10:15:47 +12:00
Paul Eggleton
6f8201fe93 Fixes for django-registration 2.x
* Newer django-registration doesn't need the workaround URLs
* We need to rename password_reset_email.html to .txt

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2016-09-20 20:46:56 +12:00
Paul Eggleton
ae550c5a6c Fix for changes to auth views in Django 1.6
Part of this change is temporary for django-registration 1.0; later
versions probably won't require the workaround URLs.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2016-09-20 20:11:13 +12:00
Paul Eggleton
4d6894ccbb Explicitly specify temporary redirection
Django 1.8 warns that the default for the "permanent" parameter to
RedirectView is changing in 1.9 from True to False, but I believe we
should be specifying False for these redirections - these are not just
redirections from old URLs and may in fact change in the future if the
site structure changes.

Part of the implementation for [YOCTO #9620].

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2016-06-12 11:33:08 +12:00
Paul Eggleton
82c632ca2d Upgrade to Django 1.6+
I'd like to be upgrading to 1.8 but that causes problems with South, and
we're not quite ready to dispense with our existing migrations yet.

Part of the implementation for [YOCTO #9620].

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2016-06-12 11:33:08 +12:00
Paul Eggleton
0c3ed04bcd Fix CSRF validation errors in password reset forms
Thanks to Michael Halstead <michael@yoctoproject.org> for this fix.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2013-03-27 09:31:26 +00:00
Alexandru DAMIAN
b483dcf2af Redirects unknown URLs to the default application
It's bad form to show the user a Page Not Found on
the first site open, so we redirect to the default
application.

Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
2013-03-08 16:30:51 +00:00
Paul Eggleton
b3afd4f2fd Add catchall 404 URL if nothing else matches
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2013-03-06 16:55:28 +00:00
Paul Eggleton
4b3aad2cea Add CAPTCHA to submission form
This should prevent spamming even though this is less likely with this
kind of site.

The CAPTCHA does not show when editing, only submitting, and is also not
shown for authenticated users.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2013-02-28 15:48:38 +00:00
Paul Eggleton
2eb5f38b21 Initial commit of layerindex-web
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2013-02-13 12:09:57 +00:00