login first err
This commit is contained in:
parent
8708501f71
commit
0cce214a9b
|
|
@ -250,6 +250,7 @@ def NCAddUser(request):
|
|||
try:
|
||||
r_status = json.loads(r.text)
|
||||
if(r_status['ocs']['meta']['statuscode'] == 100):
|
||||
|
||||
return JsonResponse({'status' : True, 'message': 'Benutzer ' + user.first_name + " " + user.last_name + ' angelegt und in die Gruppen gepackt.'})
|
||||
else:
|
||||
return JsonResponse({'status' : True, 'message': 'Benutzer ' + user.first_name + " " + user.last_name + ' konnte nicht angelegt werden. Bitte manuell prüfen!', 'message' : r.text})
|
||||
|
|
|
|||
|
|
@ -181,7 +181,17 @@ def getNCLoggedUserBySession(sid):
|
|||
final_json = json.loads(js)
|
||||
|
||||
# New user login - set initial status
|
||||
if(final_json['ocs']['meta']['status'] == 'failure'):
|
||||
try:
|
||||
if(final_json['ocs']['meta']['status'] == 'failure'):
|
||||
nc_login_headers = {'Authorization' : 'Bearer ' + sid, 'OCS-APIREQUEST' : 'true'}
|
||||
r = requests.get(settings.NEXTCLOUD_URL + "ocs/v2.php/apps/user_status/api/v1/user_status/status", headers=nc_login_headers, data={'statusType' : 'dnd'})
|
||||
|
||||
r = requests.get(settings.NEXTCLOUD_URL + "ocs/v2.php/apps/user_status/api/v1/user_status", headers=nc_login_headers)
|
||||
|
||||
xpars = xmltodict.parse(r.text)
|
||||
js = json.dumps(xpars)
|
||||
final_json = json.loads(js)
|
||||
except:
|
||||
nc_login_headers = {'Authorization' : 'Bearer ' + sid, 'OCS-APIREQUEST' : 'true'}
|
||||
r = requests.get(settings.NEXTCLOUD_URL + "ocs/v2.php/apps/user_status/api/v1/user_status/status", headers=nc_login_headers, data={'statusType' : 'dnd'})
|
||||
|
||||
|
|
@ -191,5 +201,6 @@ def getNCLoggedUserBySession(sid):
|
|||
js = json.dumps(xpars)
|
||||
final_json = json.loads(js)
|
||||
|
||||
return final_json['ocs']['data']['userId']
|
||||
return final_json['ocs']['data']['userId']
|
||||
|
||||
|
||||
Loading…
Reference in New Issue