Skip to content

Commit

Permalink
Merge pull request #154 from fsinfuhh/fix/email_field
Browse files Browse the repository at this point in the history
  • Loading branch information
lilioid authored Feb 27, 2024
2 parents 0b94159 + 8e7d884 commit 117ebd9
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 22 deletions.
3 changes: 0 additions & 3 deletions mafiasi/base/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ class Mafiasi(AbstractUser):
real_email = models.EmailField(unique=True, null=True)
new_password = None

# USED in contrib.auth to determine the mail address for thinks like password reset
EMAIL_FIELD = "real_email"

REQUIRED_FIELDS = ["email", "real_email"]

@property
Expand Down
1 change: 0 additions & 1 deletion mafiasi/registration/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
path("change_email/<token>", change_email, name="registration_change_email"),
path("request_successful", request_successful, name="registration_request_successful"),
path("account", account_settings, name="registration_account"),
path("password_reset", password_reset, name="registration_password_reset"),
]

if settings.REGISTER_ENABLED:
Expand Down
19 changes: 1 addition & 18 deletions mafiasi/registration/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ def _finish_account_request(request, info):

def _send_email_exists(request, username):
email = Mafiasi.objects.get(username=username).real_email
password_reset_url = request.build_absolute_uri(reverse("registration_password_reset"))
password_reset_url = settings.KEYCLOAK_ACCOUNT_CONSOLE_URL
email_content = render_to_string(
"registration/email_exists.txt",
{
Expand Down Expand Up @@ -359,20 +359,3 @@ def _send_mail_or_error_page(subject, content, address, request, email_shown):
"email": email_shown,
},
)


def password_reset(request):
password_reset_url = settings.PASSWORD_RESET_URL
if password_reset_url is None:
password_reset_url = (
settings.OPENID_ISSUER
+ "/login-actions/reset-credentials?"
+ urlencode(
{
"response_type": "code",
"client_id": settings.OPENID_CLIENT_ID,
"redirect_uri": request.build_absolute_uri(reverse(settings.LOGIN_URL)),
}
)
)
return redirect(password_reset_url)

0 comments on commit 117ebd9

Please sign in to comment.