Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hypha
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
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
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
ots
hypha
Commits
9f3fd9cc
Commit
9f3fd9cc
authored
6 years ago
by
Todd Dembrey
Committed by
Fredrik Jonsson
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Make sure the reset url is the correct site from the request
parent
3b2ffa7d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
opentech/apply/users/templates/users/password_reset/email.txt
+1
-1
1 addition, 1 deletion
...tech/apply/users/templates/users/password_reset/email.txt
opentech/apply/users/tests/test_views.py
+14
-0
14 additions, 0 deletions
opentech/apply/users/tests/test_views.py
with
15 additions
and
1 deletion
opentech/apply/users/templates/users/password_reset/email.txt
+
1
−
1
View file @
9f3fd9cc
{% load i18n wagtailadmin_tags %}{% base_url_setting as base_url %}
{% trans "Please follow the link below to reset your password:" %}
{
% if site.root_url %}{{ site.root_url }}{% else %}{{ base_url }}{% endif %
}{% url 'users:password_reset_confirm' uidb64=uid token=token %}
{
{ protocol }}://{{ domain }
}{% url 'users:password_reset_confirm' uidb64=uid token=token %}
{% if user.USERNAME_FIELD != "email" %}
{% trans "Your username (in case you've forgotten):" %} {{ user.get_username }}
...
...
This diff is collapsed.
Click to expand it.
opentech/apply/users/tests/test_views.py
+
14
−
0
View file @
9f3fd9cc
from
django.core
import
mail
from
django.test
import
override_settings
,
TestCase
from
django.urls
import
reverse
from
opentech.apply.utils.testing.tests
import
BaseViewTestCase
from
.factories
import
OAuthUserFactory
,
StaffFactory
,
UserFactory
...
...
@@ -44,3 +46,15 @@ class TestStaffProfileView(BaseTestProfielView):
def
test_can_set_slack_name
(
self
):
response
=
self
.
client
.
get
(
self
.
url
,
follow
=
True
)
self
.
assertContains
(
response
,
'
Slack name
'
)
class
TestPasswordReset
(
BaseViewTestCase
):
user_factory
=
UserFactory
url_name
=
'
users:{}
'
base_view_name
=
'
password_reset
'
def
test_recieves_email
(
self
):
response
=
self
.
post_page
(
None
,
data
=
{
'
email
'
:
self
.
user
.
email
})
self
.
assertRedirects
(
response
,
self
.
url
(
None
,
view_name
=
'
password_reset_done
'
))
self
.
assertEqual
(
len
(
mail
.
outbox
),
1
)
self
.
assertIn
(
'
https://testserver/account/password/reset/confirm
'
,
mail
.
outbox
[
0
].
body
)
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