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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Paul-louis Gomis
SCODOC_R6A06
Commits
50d2c91a
Commit
50d2c91a
authored
8 months ago
by
Emmanuel Viennet
Browse files
Options
Downloads
Patches
Plain Diff
Connexion CAS / non CAS: correctif
parent
d98eb7dc
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/auth/models.py
+16
-5
16 additions, 5 deletions
app/auth/models.py
sco_version.py
+1
-1
1 addition, 1 deletion
sco_version.py
with
17 additions
and
6 deletions
app/auth/models.py
+
16
−
5
View file @
50d2c91a
...
@@ -180,7 +180,7 @@ class User(UserMixin, ScoDocModel):
...
@@ -180,7 +180,7 @@ class User(UserMixin, ScoDocModel):
def
set_password
(
self
,
password
):
def
set_password
(
self
,
password
):
"
Set password
"
"
Set password
"
current_app
.
logger
.
info
(
f
"
set_password(
{
self
}
)
"
)
log
(
f
"
set_password(
{
self
}
)
"
)
if
password
:
if
password
:
self
.
password_hash
=
generate_password_hash
(
password
)
self
.
password_hash
=
generate_password_hash
(
password
)
else
:
else
:
...
@@ -213,10 +213,21 @@ class User(UserMixin, ScoDocModel):
...
@@ -213,10 +213,21 @@ class User(UserMixin, ScoDocModel):
# if CAS activated and cas_id, allow only super-user and users with cas_allow_scodoc_login
# if CAS activated and cas_id, allow only super-user and users with cas_allow_scodoc_login
cas_enabled
=
ScoDocSiteConfig
.
is_cas_enabled
()
cas_enabled
=
ScoDocSiteConfig
.
is_cas_enabled
()
if
cas_enabled
:
if
cas_enabled
and
not
self
.
is_administrator
():
if
ScoDocSiteConfig
.
get
(
"
cas_force
"
)
and
not
self
.
is_administrator
():
if
not
self
.
cas_allow_scodoc_login
:
return
False
# si CAS forcé, n'accepte que super-admin
# CAS activé et compte non autorisé à se logguer sur ScoDoc
if
self
.
cas_id
and
not
self
.
cas_allow_scodoc_login
:
log
(
f
"""
auth: login attempt for user
{
self
.
user_name
}
: scodoc login not allowed
"""
)
return
False
# si CAS activé et forcé et cas_id renseigné, on ne peut pas se logguer
if
self
.
cas_id
and
ScoDocSiteConfig
.
get
(
"
cas_force
"
):
log
(
f
"""
auth: login attempt for user
{
self
.
user_name
}
(cas_id=
'
{
self
.
cas_id
}
'
): cas forced and cas_id set: scodoc login not allowed
"""
)
return
False
return
False
if
not
self
.
password_hash
:
# user without password can't login
if
not
self
.
password_hash
:
# user without password can't login
...
...
This diff is collapsed.
Click to expand it.
sco_version.py
+
1
−
1
View file @
50d2c91a
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
"
Infos sur version ScoDoc
"
"
Infos sur version ScoDoc
"
SCOVERSION
=
"
9.7.4
1
"
SCOVERSION
=
"
9.7.4
2
"
SCONAME
=
"
ScoDoc
"
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