Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
clinicaltrials
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
david Chavalarias
clinicaltrials
Commits
3c918442
Commit
3c918442
authored
Feb 15, 2017
by
Romain Loth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
force https in login request (with warning about certificate verif during tests)
parent
be9f4ad6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
5 deletions
+26
-5
user.py
services/user.py
+26
-5
No files found.
services/user.py
View file @
3c918442
...
...
@@ -230,16 +230,25 @@ def doors_login(email, password, config):
}
}
}
NB: returned doors_uid will be None if user not found
"""
uid
=
None
sentdata
=
{
'login'
:
email
,
'password'
:
password
}
http_scheme
=
"https:"
if
doorsProto
:
sentdata
=
dumps
(
sentdata
)
http_scheme
=
"http:"
# £TODO https here !! + certificate for doors
doors_base_url
=
'http://'
+
config
[
'DOORS_HOST'
]
+
':'
+
config
[
'DOORS_PORT'
]
doors_response
=
post
(
doors_base_url
+
'/api/user'
,
data
=
sentdata
)
# (TODO generalize this logic)
if
config
[
'DOORS_PORT'
]
in
[
'80'
,
'443'
]:
# implicit port
doors_base_url
=
http_scheme
+
'//'
+
config
[
'DOORS_HOST'
]
else
:
doors_base_url
=
http_scheme
+
'//'
+
config
[
'DOORS_HOST'
]
+
':'
+
config
[
'DOORS_PORT'
]
mlog
(
"WARNING"
,
"user.doors_login: SSL certificate verification turned off for https staging tests (after tests do remove verify=False !!)"
)
doors_response
=
post
(
doors_base_url
+
'/api/user'
,
data
=
sentdata
,
verify
=
False
)
mlog
(
"INFO"
,
"/api/user doors_response"
,
doors_response
)
if
doors_response
.
ok
:
...
...
@@ -252,6 +261,12 @@ def doors_login(email, password, config):
if
login_info
[
'status'
]
==
"LoginOK"
:
uid
=
login_info
[
'userID'
]
elif
match
(
r'User .* not found$'
,
doors_response
.
json
()):
uid
=
None
mlog
(
'INFO'
,
"doors_login says user '
%
s' was not found"
%
email
)
else
:
raise
Exception
(
'Doors request failed'
)
return
uid
def
doors_register
(
email
,
password
,
name
,
config
):
...
...
@@ -261,11 +276,17 @@ def doors_register(email, password, name, config):
uid
=
None
sentdata
=
{
'login'
:
email
,
'password'
:
password
,
'name'
:
name
}
http_scheme
=
"https:"
if
doorsProto
:
sentdata
=
dumps
(
sentdata
)
http_scheme
=
"http:"
if
config
[
'DOORS_PORT'
]
in
[
'80'
,
'443'
]:
# implicit port
doors_base_url
=
http_scheme
+
'//'
+
config
[
'DOORS_HOST'
]
else
:
doors_base_url
=
http_scheme
+
'//'
+
config
[
'DOORS_HOST'
]
+
':'
+
config
[
'DOORS_PORT'
]
# £TODO https here !! + certificate for doors
doors_base_url
=
'http://'
+
config
[
'DOORS_HOST'
]
+
':'
+
config
[
'DOORS_PORT'
]
doors_response
=
post
(
doors_base_url
+
'/api/register'
,
data
=
sentdata
)
mlog
(
"INFO"
,
"/api/register doors_response"
,
doors_response
)
...
...
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