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
4ef5b480
Commit
4ef5b480
authored
5 years ago
by
Patrick Jentsch
Browse files
Options
Downloads
Patches
Plain Diff
Add reset token generation functionality in User class.
parent
ed921b68
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
app/models.py
+6
-0
6 additions, 0 deletions
app/models.py
with
6 additions
and
0 deletions
app/models.py
+
6
−
0
View file @
4ef5b480
from
flask
import
current_app
from
flask_login
import
UserMixin
from
flask_login
import
UserMixin
from
itsdangerous
import
TimedJSONWebSignatureSerializer
as
Serializer
from
werkzeug.security
import
generate_password_hash
,
check_password_hash
from
werkzeug.security
import
generate_password_hash
,
check_password_hash
from
.
import
db
from
.
import
db
from
.
import
login_manager
from
.
import
login_manager
...
@@ -26,6 +28,10 @@ class User(UserMixin, db.Model):
...
@@ -26,6 +28,10 @@ class User(UserMixin, db.Model):
password_hash
=
db
.
Column
(
db
.
String
(
128
))
password_hash
=
db
.
Column
(
db
.
String
(
128
))
def
generate_reset_token
(
self
,
expiration
=
3600
):
s
=
Serializer
(
current_app
.
config
[
'
SECRET_KEY
'
],
expiration
)
return
s
.
dumps
({
'
reset
'
:
self
.
id
}).
decode
(
'
utf-8
'
)
@property
@property
def
password
(
self
):
def
password
(
self
):
raise
AttributeError
(
'
password is not a readable attribute
'
)
raise
AttributeError
(
'
password is not a readable attribute
'
)
...
...
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