Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
third-party
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cooperatic-foodcoops
third-party
Commits
1dde715e
Commit
1dde715e
authored
Jun 01, 2022
by
François C.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adaptations pour connexion via formulaire externe
parent
9afd5f37
Pipeline
#2223
passed with stage
in 1 minute 32 seconds
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
2 deletions
+16
-2
models.py
members/models.py
+3
-2
urls.py
members/urls.py
+2
-0
views.py
members/views.py
+11
-0
No files found.
members/models.py
View file @
1dde715e
...
...
@@ -121,7 +121,7 @@ class CagetteMember(models.Model):
'id DESC'
)
@staticmethod
def
get_credentials
(
request
):
def
get_credentials
(
request
,
external
=
False
):
import
hashlib
data
=
{}
...
...
@@ -171,7 +171,7 @@ class CagetteMember(models.Model):
data
[
'errnum'
]
=
2
# data['res'] = res
elif
'token'
in
request
.
COOKIES
and
'id'
in
request
.
COOKIES
:
elif
external
is
False
and
'token'
in
request
.
COOKIES
and
'id'
in
request
.
COOKIES
:
api
=
OdooAPI
()
cond
=
[[
'id'
,
'='
,
request
.
COOKIES
[
'id'
]]]
fields
=
[
'create_date'
,
'email'
]
...
...
@@ -187,6 +187,7 @@ class CagetteMember(models.Model):
else
:
data
[
'failure'
]
=
True
if
not
(
'failure'
in
data
):
if
external
is
False
:
data
[
'login'
]
=
login
c_db_data
=
CagetteMember
.
get_couchdb_data
(
login
)
if
len
(
c_db_data
)
>
0
and
'validation_state'
in
c_db_data
:
...
...
members/urls.py
View file @
1dde715e
...
...
@@ -71,4 +71,6 @@ urlpatterns = [
url
(
r'^update_members_makeups$'
,
admin
.
update_members_makeups
),
url
(
r'^get_member_info/(\d+)$'
,
admin
.
get_member_info
),
url
(
r'^get_attached_members$'
,
admin
.
get_attached_members
),
# External login
url
(
r'^external_login$'
,
views
.
external_login
)
]
members/views.py
View file @
1dde715e
...
...
@@ -443,3 +443,13 @@ def save_partner_info(request):
else
:
res
[
'error'
]
=
"Forbidden"
return
JsonResponse
(
res
,
safe
=
False
)
### External login
@csrf_exempt
def
external_login
(
request
):
"""Post request send from external login page, such as Question2Answer."""
# TODO : Allow only known host (based on domain ? key ?)
res
=
{}
CagetteMember
.
get_credentials
(
request
,
external
=
True
)
return
JsonResponse
(
res
,
safe
=
False
)
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment