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
0e1681db
Commit
0e1681db
authored
Sep 10, 2021
by
Damien Moulard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow attached people to connect
parent
a479186a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
11 deletions
+22
-11
models.py
members/models.py
+18
-10
models.py
shifts/models.py
+2
-1
index.html
templates/members_space/index.html
+2
-0
No files found.
members/models.py
View file @
0e1681db
...
@@ -95,19 +95,27 @@ class CagetteMember(models.Model):
...
@@ -95,19 +95,27 @@ class CagetteMember(models.Model):
api
=
OdooAPI
()
api
=
OdooAPI
()
cond
=
[[
'email'
,
'='
,
login
]]
cond
=
[[
'email'
,
'='
,
login
]]
if
getattr
(
settings
,
'ALLOW_NON_MEMBER_TO_CONNECT'
,
False
)
is
False
:
if
getattr
(
settings
,
'ALLOW_NON_MEMBER_TO_CONNECT'
,
False
)
is
False
:
cond
.
append
(
'|'
)
cond
.
append
([
'is_member'
,
'='
,
True
])
cond
.
append
([
'is_member'
,
'='
,
True
])
fields
=
[
'name'
,
'email'
,
'birthdate'
,
'create_date'
,
'cooperative_state'
]
cond
.
append
([
'is_associated_people'
,
'='
,
True
])
fields
=
[
'name'
,
'email'
,
'birthdate'
,
'create_date'
,
'cooperative_state'
,
'is_associated_people'
]
res
=
api
.
search_read
(
'res.partner'
,
cond
,
fields
)
res
=
api
.
search_read
(
'res.partner'
,
cond
,
fields
)
if
(
res
and
len
(
res
)
>=
1
):
if
(
res
and
len
(
res
)
>=
1
):
for
coop
in
res
:
for
item
in
res
:
y
,
m
,
d
=
coop
[
'birthdate'
]
.
split
(
'-'
)
coop
=
item
password
=
password
.
replace
(
'/'
,
''
)
if
item
[
"is_associated_people"
]
==
True
:
if
(
password
==
d
+
m
+
y
):
break
data
[
'id'
]
=
coop
[
'id'
]
auth_token_seed
=
fp
+
coop
[
'create_date'
]
y
,
m
,
d
=
coop
[
'birthdate'
]
.
split
(
'-'
)
data
[
'auth_token'
]
=
hashlib
.
sha256
(
auth_token_seed
.
encode
(
'utf-8'
))
.
hexdigest
()
password
=
password
.
replace
(
'/'
,
''
)
data
[
'token'
]
=
hashlib
.
sha256
(
coop
[
'create_date'
]
.
encode
(
'utf-8'
))
.
hexdigest
()
if
(
password
==
d
+
m
+
y
):
data
[
'coop_state'
]
=
coop
[
'cooperative_state'
]
data
[
'id'
]
=
coop
[
'id'
]
auth_token_seed
=
fp
+
coop
[
'create_date'
]
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
[
'cooperative_state'
]
if
not
(
'auth_token'
in
data
):
if
not
(
'auth_token'
in
data
):
data
[
'failure'
]
=
True
data
[
'failure'
]
=
True
data
[
'msg'
]
=
"Erreur dans le mail ou le mot de passe"
data
[
'msg'
]
=
"Erreur dans le mail ou le mot de passe"
...
...
shifts/models.py
View file @
0e1681db
...
@@ -37,7 +37,8 @@ class CagetteShift(models.Model):
...
@@ -37,7 +37,8 @@ class CagetteShift(models.Model):
'shift_type'
,
'date_alert_stop'
,
'date_delay_stop'
,
'extension_ids'
,
'shift_type'
,
'date_alert_stop'
,
'date_delay_stop'
,
'extension_ids'
,
'cooperative_state'
,
'final_standard_point'
,
'create_date'
,
'cooperative_state'
,
'final_standard_point'
,
'create_date'
,
'final_ftop_point'
,
'in_ftop_team'
,
'leave_ids'
,
'makeups_to_do'
,
'barcode_base'
,
'final_ftop_point'
,
'in_ftop_team'
,
'leave_ids'
,
'makeups_to_do'
,
'barcode_base'
,
'street'
,
'street ,'
'zip'
,
'city'
,
'mobile'
,
'phone'
,
'email'
]
'street'
,
'street2 ,'
'zip'
,
'city'
,
'mobile'
,
'phone'
,
'email'
,
'is_associated_people'
,
'parent_id'
]
partnerData
=
self
.
o_api
.
search_read
(
'res.partner'
,
cond
,
fields
,
1
)
partnerData
=
self
.
o_api
.
search_read
(
'res.partner'
,
cond
,
fields
,
1
)
if
partnerData
:
if
partnerData
:
partnerData
=
partnerData
[
0
]
partnerData
=
partnerData
[
0
]
...
...
templates/members_space/index.html
View file @
0e1681db
...
@@ -59,6 +59,8 @@
...
@@ -59,6 +59,8 @@
"mobile"
:
"{{partnerData.mobile}}"
,
"mobile"
:
"{{partnerData.mobile}}"
,
"phone"
:
"{{partnerData.phone}}"
,
"phone"
:
"{{partnerData.phone}}"
,
"email"
:
"{{partnerData.email}}"
,
"email"
:
"{{partnerData.email}}"
,
"is_associated_people"
:
"{{partnerData.is_associated_people}}"
,
"parent_id"
:
"{{partnerData.parent_id}}"
,
}
}
</script>
</script>
<script
src=
"{% static "
js
/
all_common
.
js
"
%}?
v=
"></script>
<script
src=
"{% static "
js
/
all_common
.
js
"
%}?
v=
"></script>
...
...
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