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
4827eed4
Commit
4827eed4
authored
Jun 01, 2022
by
François C.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add data when external login
parent
1dde715e
Pipeline
#2224
passed with stage
in 1 minute 22 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
+11
-2
models.py
members/models.py
+9
-0
views.py
members/views.py
+2
-2
No files found.
members/models.py
View file @
4827eed4
...
...
@@ -160,6 +160,15 @@ class CagetteMember(models.Model):
data
[
'auth_token'
]
=
hashlib
.
sha256
(
auth_token_seed
.
encode
(
'utf-8'
))
.
hexdigest
()
data
[
'token'
]
=
hashlib
.
sha256
(
coop
[
'create_date'
]
.
encode
(
'utf-8'
))
.
hexdigest
()
data
[
'coop_state'
]
=
coop_state
if
external
is
True
:
from
outils.functions
import
extract_firstname_lastname
name_sep
=
getattr
(
settings
,
'SUBSCRIPTION_NAME_SEP'
,
' '
)
name_elts
=
extract_firstname_lastname
(
coop
[
'name'
],
name_sep
)
data
[
'lastname'
]
=
name_elts
[
'lastname'
]
if
name_elts
[
'firstname'
]
!=
name_elts
[
'lastname'
]:
data
[
'firstname'
]
=
name_elts
[
'firstname'
]
else
:
data
[
'firstname'
]
=
''
if
not
(
'auth_token'
in
data
):
data
[
'failure'
]
=
True
...
...
members/views.py
View file @
4827eed4
...
...
@@ -450,6 +450,5 @@ def save_partner_info(request):
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
)
res
=
{
'credentials'
:
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