Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
nopaque
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SFB 1288 - INF
nopaque
Commits
3b6c9f22
Commit
3b6c9f22
authored
5 years ago
by
Stephan Porada
Browse files
Options
Downloads
Patches
Plain Diff
Add email confirmation for nuew users
parent
8c121a63
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/templates/auth/email/confirm.html.j2
+8
-0
8 additions, 0 deletions
app/templates/auth/email/confirm.html.j2
app/templates/auth/email/confirm.txt.j2
+11
-0
11 additions, 0 deletions
app/templates/auth/email/confirm.txt.j2
tests/test_user_model.py
+26
-0
26 additions, 0 deletions
tests/test_user_model.py
with
45 additions
and
0 deletions
app/templates/auth/email/confirm.html.j2
0 → 100644
+
8
−
0
View file @
3b6c9f22
<p>Dear {{ user.username }},</p>
<p>Welcome to <b>Opaque</b>!</p>
<p>To confirm your account please <a href="{{ url_for('auth.confirm', token=token, _external=True) }}">click here</a>.</p>
<p>Alternatively, you can paste the following link in your browser's address bar:</p>
<p>{{ url_for('auth.confirm', token=token, _external=True) }}</p>
<p>Sincerely,</p>
<p>The Opaque Team</p>
<p><small>Note: replies to this email address are not monitored.</small></p>
This diff is collapsed.
Click to expand it.
app/templates/auth/email/confirm.txt.j2
0 → 100644
+
11
−
0
View file @
3b6c9f22
Dear {{ user.username }},
Welcome to Opaque!
To confirm your account please click on the following link:
{{ url_for('auth.confirm', token=token, _external=True) }}
Sincerely,
The Opaque Team
Note: replies to this email address are not monitored.
This diff is collapsed.
Click to expand it.
tests/test_user_model.py
+
26
−
0
View file @
3b6c9f22
import
unittest
import
time
from
app.models
import
User
from
app
import
db
class
UserModelTestCase
(
unittest
.
TestCase
):
...
...
@@ -21,3 +23,27 @@ class UserModelTestCase(unittest.TestCase):
u
=
User
(
password
=
'
cat
'
)
u2
=
User
(
password
=
'
cat
'
)
self
.
assertTrue
(
u
.
password_hash
!=
u2
.
password_hash
)
def
test_valid_confirmation_token
(
self
):
u
=
User
(
password
=
'
cat
'
)
db
.
session
.
add
(
u
)
db
.
session
.
commit
()
token
=
u
.
generate_confirmation_token
()
self
.
assertTrue
(
u
.
confirm
(
token
))
def
test_invalid_confirmation_token
(
self
):
u1
=
User
(
password
=
'
cat
'
)
u2
=
User
(
password
=
'
dog
'
)
db
.
session
.
add
(
u1
)
db
.
session
.
add
(
u2
)
db
.
session
.
commit
()
token
=
u1
.
generate_confirmation_token
()
self
.
assertFalse
(
u2
.
confirm
(
token
))
def
test_expired_confirmation_token
(
self
):
u
=
User
(
password
=
'
cat
'
)
db
.
session
.
add
(
u
)
db
.
session
.
commit
()
token
=
u
.
generate_confirmation_token
(
1
)
time
.
sleep
(
2
)
self
.
assertFalse
(
u
.
confirm
(
token
))
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