-
-
Notifications
You must be signed in to change notification settings - Fork 22
Dj rest auth #187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Dj rest auth #187
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
dcbab36
Added osprojects to admin interface.
BethanyG 31edf0f
Added osprojects to admin interface.
BethanyG d585cdd
Added OSProjects to admin interface.
BethanyG 606c871
added django-res-auth and associated basic settings to test DRF and aβ¦
BethanyG 30936fe
Working state Mon Sept 14 - dj-rest-auth and django-allauth
BethanyG cdadba1
Removed django-rest-jwt and django-rest-auth added simplejwt and dj-rβ¦
BethanyG 782e05b
Added routes for registration and allauth.
BethanyG 040c6f3
Added password reset email template.
BethanyG ef3a5ad
Added confirm_email method. Will probably remove it as uneeded later.
BethanyG 7e6ff72
Added CustomUserDetailsSerializer. Stubbed other serializers for conβ¦
BethanyG e97153b
Added routes for registration, email confirmation, password reset, loβ¦
BethanyG b6c4ac2
Added CustomVerifyEmailView to enable email verify emails from the baβ¦
BethanyG f06a74c
Added tests for registration flow, token authorization, email verificβ¦
BethanyG 221b7b6
Fixed tests that were failing due to auth change.
BethanyG e8197e7
Added final simpleJWT tests for auth.
BethanyG f220224
Added skips for User tests broken due to auth changes.
BethanyG bb47eb0
Removed django-rest_auth and django-rest-jwt from requirememts.
BethanyG 9fd6eb7
Removed unused import that was causing an error.
BethanyG 2670780
Removed excess space from email_confirmation_subject.txt filename.
BethanyG 9451986
Revert "Removed excess space from email_confirmation_subject.txt fileβ¦
BethanyG aa6218a
Attempted to fix intermittent email verification post test failure byβ¦
BethanyG f91a22d
Changed order of included URLs.
BethanyG a2b2b4b
Added specific path for email link verification post and changed pathβ¦
BethanyG 569ee99
Fun trick: If your regex fails to capture all the key generations casβ¦
BethanyG 35c5610
Removed print statement from email post verificaton test case.
BethanyG 75e9461
Corrected circular reference that was breaking tests and renamed fileβ¦
BethanyG b2ba2c2
Removed regex from path url to avoid djang deprecation and migration β¦
BethanyG b127b67
Merge branch 'main' into dj-rest-auth
lpatmo 4a2bfd4
Update project/config/settings/base.py
BethanyG 604bac8
Update project/userauth/tests.py
BethanyG File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
project/core/templates/account/email/email_confirmation_message.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{% load account %}{% user_display user as user_display %}{% load i18n %}{% autoescape off %}{% blocktrans with site_name=current_site.name site_domain=current_site.domain %}Hello from {{ site_name }}! | ||
|
||
You're receiving this e-mail because user {{ user_display }} has used this e-mail address to register an account on {{ site_domain }}. | ||
|
||
To confirm this is correct, go to {{ activate_url }} | ||
{% endblocktrans %} | ||
{% blocktrans with site_name=current_site.name site_domain=current_site.domain %}Thank you from {{ site_name }}! | ||
{{ site_domain }}{% endblocktrans %} | ||
{% endautoescape %} |
4 changes: 4 additions & 0 deletions
4
project/core/templates/account/email/email_confirmation_subject.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{% load i18n %} | ||
{% autoescape off %} | ||
{% blocktrans %}Please Confirm Your E-mail Address{% endblocktrans %} | ||
{% endautoescape %} |
14 changes: 14 additions & 0 deletions
14
project/core/templates/registration/password_reset_email.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{% load i18n %}{% autoescape off %} | ||
2 {% blocktrans %}You're receiving this email because you requested a password reset for your user account at {{ site_name }}.{% endblocktrans %} | ||
3 | ||
4 {% trans "Please go to the following page and choose a new password:" %} | ||
5 {% block reset_link %} | ||
6 {{ protocol }}://{{ domain }}{% url 'userauth:password_reset_confirm' uidb64=uid token=token %} | ||
7 {% endblock %} | ||
8 {% trans "Your username, in case you've forgotten:" %} {{ user.get_username }} | ||
9 | ||
10 {% trans "Thanks for using our site!" %} | ||
11 | ||
12 {% blocktrans %}The {{ site_name }} team{% endblocktrans %} | ||
13 | ||
14 {% endautoescape %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,17 @@ | ||
from django.contrib import admin | ||
from .models import OSProjects | ||
|
||
|
||
# Register your models here. | ||
class OSProjectAdmin(admin.ModelAdmin): | ||
|
||
list_display = ['tag_list'] | ||
|
||
def get_queryset(self, request): | ||
return super().get_queryset(request).prefetch_related('tags') | ||
|
||
def tag_list(self, obj): | ||
return u", ".join(o.name for o in obj.tags.all()) | ||
|
||
|
||
admin.site.register(OSProjects) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from allauth.account.adapter import DefaultAccountAdapter | ||
from django.contrib.sites.models import Site | ||
from allauth.utils import build_absolute_uri | ||
from django.conf import settings | ||
|
||
class CustomAccountAdapter(DefaultAccountAdapter): | ||
|
||
def get_email_confirmation_url(self, request, emailconfirmation): | ||
url = settings.CUSTOM_ACCOUNT_CONFIRM_EMAIL_URL.format(emailconfirmation.key) | ||
result = build_absolute_uri(request, url) | ||
return result | ||
|
||
def confirm_email(self, request, email_address): | ||
""" | ||
Marks the email address as confirmed on the db | ||
""" | ||
email_address.verified = True | ||
email_address.set_as_primary(conditional=True) | ||
email_address.save() |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.