X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=rest%2Fcredentials.py;h=a8c8ba7e4833b152347c53cdeca7989ee01684ed;hb=ddcdaf8d61df7f4a2a0da11c23190b56ed914464;hp=fa1f9b83f30dc4015825206d553d94cb4799f8fb;hpb=7f055ed854bca5d058c0885a5ec2eaf9882c3a53;p=myslice.git diff --git a/rest/credentials.py b/rest/credentials.py index fa1f9b83..a8c8ba7e 100644 --- a/rest/credentials.py +++ b/rest/credentials.py @@ -2,16 +2,24 @@ from django.http import HttpResponse from portal.actions import clear_user_creds import json -def dispatch(request, action, object): +def dispatch(request, action): if (action == 'clear') : - try : - res = clear_user_creds(request, object) - except : - pass + res=[] + emails = request.POST.getlist('emails[]') + if not emails: + emails = request.GET.getlist('emails[]') + if emails : + for email in emails : + try : + clear = clear_user_creds(request, email) + if clear is not None: + res.append(clear) + except : + pass - if res is not None : - ret = { "ret" : 1, "email" : res } + if not res : + ret = { "ret" : 1, "emails" : emails } else : ret = { "ret" : 0 }