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
2f35c96b
Commit
2f35c96b
authored
Feb 08, 2017
by
Romain Loth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new doors status protocol
parent
8b0ce079
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
15 deletions
+48
-15
user.py
services/user.py
+12
-6
comex_user_shared_auth.js
static/js/comex_user_shared_auth.js
+36
-9
No files found.
services/user.py
View file @
2f35c96b
...
...
@@ -210,7 +210,7 @@ class User(object):
from
requests
import
post
# dev flag
doorsProto
=
Tru
e
doorsProto
=
Fals
e
def
doors_login
(
email
,
password
,
config
):
...
...
@@ -245,8 +245,12 @@ def doors_login(email, password, config):
if
doors_response
.
ok
:
login_info
=
loads
(
doors_response
.
content
.
decode
())
if
login_info
[
'status'
]
==
"login ok"
:
uid
=
login_info
[
'userInfo'
][
'id'
][
'id'
]
if
doorsProto
:
if
login_info
[
'status'
]
==
"login ok"
:
uid
=
login_info
[
'userInfo'
][
'id'
][
'id'
]
else
:
if
login_info
[
'status'
]
==
"LoginOK"
:
uid
=
login_info
[
'userID'
]
return
uid
...
...
@@ -271,7 +275,9 @@ def doors_register(email, password, name, config):
answer
=
loads
(
doors_response
.
content
.
decode
())
return
(
doors_response
.
ok
if
doorsProto
:
return
(
doors_response
.
ok
and
(
answer
[
'status'
]
==
"registration email sent"
))
return
uid
else
:
return
(
doors_response
.
ok
and
(
answer
[
'status'
]
==
"RegistrationPending"
))
static/js/comex_user_shared_auth.js
View file @
2f35c96b
...
...
@@ -26,7 +26,7 @@ cmxClt = (function(cC) {
// -------------------
// true if we are using first minidoors prototype (commit fca0f79)
// otherwise assume normal doors (commit >= a0ce580)
cC
.
uauth
.
protoDoors
=
tru
e
cC
.
uauth
.
protoDoors
=
fals
e
// #doors_connect.value ~~> like a @classparam for uauthforms
// :str: "doors_hostname:doors_port"
...
...
@@ -249,13 +249,25 @@ cmxClt = (function(cC) {
var
doorsMsg
=
doorsResp
[
1
]
// status true iff login is as expected and format ok
obja
.
emailStatus
=
(
(
obja
.
emailIdSupposedToExist
&&
(
doorsMsg
==
"login exists"
))
||
(
!
obja
.
emailIdSupposedToExist
&&
(
doorsMsg
==
"login available"
))
)
if
(
cC
.
uauth
.
protoDoors
)
{
obja
.
emailStatus
=
(
(
obja
.
emailIdSupposedToExist
&&
(
doorsMsg
==
"login exists"
))
||
(
!
obja
.
emailIdSupposedToExist
&&
(
doorsMsg
==
"login available"
))
)
}
else
{
obja
.
emailStatus
=
(
(
obja
.
emailIdSupposedToExist
&&
(
doorsMsg
==
"LoginExists"
))
||
(
!
obja
.
emailIdSupposedToExist
&&
(
doorsMsg
==
"LoginAvailable"
))
)
}
// signals the form change after this input status change
// (we're now after async came back, so long after keyup finished)
obja
.
elForm
.
dispatchEvent
(
new
CustomEvent
(
'change'
))
...
...
@@ -433,6 +445,9 @@ cmxClt = (function(cC) {
var
scheme
=
cC
.
uauth
.
protoDoors
?
'http'
:
'https'
// FORDEBUG
scheme
=
'http'
$
.
ajax
({
contentType
:
cC
.
uauth
.
protoDoors
?
"application/json"
:
"application/x-www-form-urlencoded; charset=UTF-8"
,
dataType
:
'json'
,
...
...
@@ -442,21 +457,33 @@ cmxClt = (function(cC) {
type
:
'POST'
,
// traditional: !cC.uauth.protoDoors,
success
:
function
(
data
)
{
console
.
log
(
'response data'
,
data
)
if
(
typeof
data
!=
'undefined'
&&
apiAction
==
'userExists'
)
{
// userExists success case: it's all in the message :)
doorsUid
=
null
doorsMsg
=
data
.
status
}
else
if
(
typeof
data
!=
'undefined'
else
if
(
cC
.
uauth
.
protoDoors
&&
typeof
data
!=
'undefined'
&&
typeof
data
.
userInfo
!=
undefined
&&
typeof
data
.
userInfo
.
id
!=
undefined
&&
typeof
data
.
userInfo
.
id
.
id
!=
undefined
&&
typeof
data
.
status
==
'string'
)
{
// prototype version
// main success case: get the id
doorsUid
=
data
.
userInfo
.
id
.
id
doorsMsg
=
data
.
status
}
else
if
(
!
cC
.
uauth
.
protoDoors
&&
typeof
data
!=
'undefined'
&&
typeof
data
.
userID
!=
undefined
&&
typeof
data
.
status
==
'string'
)
{
// main success case: get the id
doorsUid
=
data
.
userID
doorsMsg
=
data
.
status
}
else
{
doorsMsg
=
"Unknown response for doors apiAction ("
+
apiAction
+
"):"
doorsMsg
+=
'"'
+
JSON
.
stringify
(
data
).
substring
(
0
,
10
)
+
'..."'
...
...
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