SciPost Code Repository
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SciPost
Manage
Activity
Members
Labels
Plan
Issues
118
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SciPost
SciPost
Commits
0b3ea398
Commit
0b3ea398
authored
4 months ago
by
George Katsikas
Browse files
Options
Downloads
Patches
Plain Diff
allow user to verify own email addresses
parent
b455db79
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scipost_django/profiles/views.py
+8
-1
8 additions, 1 deletion
scipost_django/profiles/views.py
with
8 additions
and
1 deletion
scipost_django/profiles/views.py
+
8
−
1
View file @
0b3ea398
...
@@ -580,7 +580,6 @@ def _hx_profile_email_toggle_valid(request, email_id):
...
@@ -580,7 +580,6 @@ def _hx_profile_email_toggle_valid(request, email_id):
)
)
@permission_required_htmx
(
"
scipost.can_verify_profile_emails
"
)
def
_hx_profile_email_request_verification
(
request
,
email_id
):
def
_hx_profile_email_request_verification
(
request
,
email_id
):
"""
Toggle verified/unverified status of ProfileEmail.
"""
"""
Toggle verified/unverified status of ProfileEmail.
"""
profile_email
=
get_object_or_404
(
ProfileEmail
,
pk
=
email_id
)
profile_email
=
get_object_or_404
(
ProfileEmail
,
pk
=
email_id
)
...
@@ -588,6 +587,14 @@ def _hx_profile_email_request_verification(request, email_id):
...
@@ -588,6 +587,14 @@ def _hx_profile_email_request_verification(request, email_id):
if
not
request
.
method
==
"
PATCH
"
:
if
not
request
.
method
==
"
PATCH
"
:
raise
BadRequest
(
"
Invalid request method
"
)
raise
BadRequest
(
"
Invalid request method
"
)
is_mail_owner
=
request
.
user
.
contributor
.
profile
==
profile_email
.
profile
can_verify_emails
=
request
.
user
.
has_perm
(
"
scipost.can_verify_profile_emails
"
)
if
not
(
is_mail_owner
or
can_verify_emails
):
return
HTMXResponse
(
"
You do not have the required permissions to verify this email.
"
,
tag
=
"
danger
"
,
)
if
not
profile_email
.
verified
:
if
not
profile_email
.
verified
:
profile_email
.
send_verification_email
()
profile_email
.
send_verification_email
()
messages
.
success
(
messages
.
success
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment