Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SCODOC_R6A06
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
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
Paul-louis Gomis
SCODOC_R6A06
Commits
6e2f3cb2
Commit
6e2f3cb2
authored
3 months ago
by
Emmanuel Viennet
Browse files
Options
Downloads
Patches
Plain Diff
User: augmente timeout token reset password.
parent
c4d45ae3
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
app/auth/models.py
+10
-4
10 additions, 4 deletions
app/auth/models.py
app/auth/routes.py
+2
-1
2 additions, 1 deletion
app/auth/routes.py
app/views/users.py
+3
-0
3 additions, 0 deletions
app/views/users.py
sco_version.py
+1
-1
1 addition, 1 deletion
sco_version.py
with
16 additions
and
6 deletions
app/auth/models.py
+
10
−
4
View file @
6e2f3cb2
...
...
@@ -258,13 +258,16 @@ class User(UserMixin, ScoDocModel):
return
True
return
False
def
get_reset_password_token
(
self
,
expires_in
=
600
):
"
Un token pour réinitialiser son mot de passe
"
return
jwt
.
encode
(
def
get_reset_password_token
(
self
,
expires_in
=
24
*
60
*
60
):
"""
Un token pour réinitialiser son mot de passe.
Par défaut valide durant 24 heures.
"""
token
=
jwt
.
encode
(
{
"
reset_password
"
:
self
.
id
,
"
exp
"
:
time
()
+
expires_in
},
current_app
.
config
[
"
SECRET_KEY
"
],
algorithm
=
"
HS256
"
,
)
return
token
@staticmethod
def
verify_reset_password_token
(
token
):
...
...
@@ -275,7 +278,10 @@ class User(UserMixin, ScoDocModel):
)
except
jwt
.
exceptions
.
ExpiredSignatureError
:
log
(
"
verify_reset_password_token: token expired
"
)
except
:
# pylint: disable=bare-except
return
None
except
Exception
as
exc
:
# pylint: disable=bare-except
log
(
"
verify_reset_password_token: checking token
'
{token}
'"
)
log
(
f
"
verify_reset_password_token:
{
exc
}
"
)
return
None
try
:
user_id
=
token
[
"
reset_password
"
]
...
...
This diff is collapsed.
Click to expand it.
app/auth/routes.py
+
2
−
1
View file @
6e2f3cb2
...
...
@@ -9,7 +9,7 @@ from flask import redirect, url_for, request
from
flask_login
import
login_user
,
current_user
from
sqlalchemy
import
func
from
app
import
db
from
app
import
db
,
log
from
app.auth
import
bp
,
cas
,
logic
from
app.auth.forms
import
(
CASUsersImportConfigForm
,
...
...
@@ -168,6 +168,7 @@ def reset_password(token):
return
redirect
(
url_for
(
"
scodoc.index
"
))
user
:
User
=
User
.
verify_reset_password_token
(
token
)
if
user
is
None
:
log
(
"
reset_password: can
'
t retreive user
"
)
return
redirect
(
url_for
(
"
scodoc.index
"
))
form
=
ResetPasswordForm
()
if
form
.
validate_on_submit
():
...
...
This diff is collapsed.
Click to expand it.
app/views/users.py
+
3
−
0
View file @
6e2f3cb2
...
...
@@ -308,6 +308,7 @@ def create_user_form(user_name=None, edit=0, all_roles=True):
"
allow_null
"
:
False
,
"
readonly
"
:
edit_only_roles
,
"
strip
"
:
True
,
"
attributes
"
:
[
'
autocomplete=
"
off
"'
],
},
),
(
...
...
@@ -318,6 +319,7 @@ def create_user_form(user_name=None, edit=0, all_roles=True):
"
allow_null
"
:
False
,
"
readonly
"
:
edit_only_roles
,
"
strip
"
:
True
,
"
attributes
"
:
[
'
autocomplete=
"
off
"'
],
},
),
]
...
...
@@ -355,6 +357,7 @@ def create_user_form(user_name=None, edit=0, all_roles=True):
"
explanation
"
:
"""
nom utilisé pour la connexion.
Doit être unique parmi tous les utilisateurs.
Lettres ou chiffres uniquement.
"""
,
"
attributes
"
:
[
'
autocomplete=
"
off
"'
],
},
),
(
"
formsemestre_id
"
,
{
"
input_type
"
:
"
hidden
"
}),
...
...
This diff is collapsed.
Click to expand it.
sco_version.py
+
1
−
1
View file @
6e2f3cb2
...
...
@@ -3,7 +3,7 @@
"
Infos sur version ScoDoc
"
SCOVERSION
=
"
9.7.5
4
"
SCOVERSION
=
"
9.7.5
5
"
SCONAME
=
"
ScoDoc
"
...
...
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