clear credentials of a list of mails (post)
[unfold.git] / rest / credentials.py
1 from django.http                    import HttpResponse
2 from portal.actions import clear_user_creds
3 import json
4
5 def dispatch(request, action):
6     
7     if (action == 'clear') :
8         res=[]
9         emails = request.POST.getlist('emails[]')
10         if emails :
11             for email in emails :
12                 try :
13                     res.append(clear_user_creds(request, email))
14                 except :
15                     pass
16         
17         if not res :
18             ret = { "ret" : 1, "emails" : res }
19         else :
20             ret = { "ret" : 0 }
21     
22     return HttpResponse(json.dumps(ret), content_type="application/json")