-
Notifications
You must be signed in to change notification settings - Fork 0
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
fix saml login errors after rebase on a+ #95
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,6 @@ | |
from djangosaml2.urls import urlpatterns | ||
from djangosaml2.views import AssertionConsumerServiceView | ||
|
||
from apps.users.models import User | ||
|
||
from .urls import urlpatterns as custom_urlpatterns | ||
|
||
|
||
|
@@ -15,21 +13,19 @@ def apply_custom_overwrites(): | |
|
||
|
||
def customize_session(self, user, session_info): | ||
user_obj = User.objects.get(email=user) | ||
if not EmailAddress.objects.filter(user=user_obj, email=user).exists(): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. passing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. because of the latest allauth, we changed I think the mandatory fields. did you try There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, this is what I did in this PR |
||
email_address = EmailAddress(user=user_obj, email=user) | ||
if not EmailAddress.objects.filter(user=user, email=user.email).exists(): | ||
email_address = EmailAddress(user=user, email=user.email) | ||
email_address.save() | ||
if not EmailAddress.objects.filter(user=user_obj, primary=True).exists(): | ||
email_address = EmailAddress.objects.get(user=user_obj, email=user) | ||
if not EmailAddress.objects.filter(user=user, primary=True).exists(): | ||
email_address = EmailAddress.objects.get(user=user, email=user.email) | ||
email_address.primary = True | ||
email_address.save() | ||
|
||
|
||
def custom_redirect(self, user, relay_state, session_info): | ||
user_obj = User.objects.get(email=user) | ||
email_address = EmailAddress.objects.get(user=user_obj, email=user) | ||
email_address = EmailAddress.objects.get(user=user, email=user.email) | ||
if not email_address.verified: | ||
signup = reverse('saml2_signup') | ||
signup = reverse("saml2_signup") | ||
if relay_state: | ||
signup += "?next={}".format(relay_state) | ||
return signup |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
### Fixed | ||
|
||
- fix saml login broken after rebase on latest a+ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the only thing which changed here is adding this line, the rest was auto-formatting