Example #1
0
def logout(request):
	#get authentication mgr
	mgr=AuthMgr(request)

	#log user out
	mgr.logout()
	
	#return authentication
	return HttpResponse( AIResponse().serialize() )
Example #2
0
def login(request,uname,pwd):
	#get authentication mgr
	mgr=AuthMgr(request)
	
	#authenticate user
	auth=mgr.login(uname,pwd)
	if auth==False:
		return HttpResponse( AIResponse(error=AIError(AIError.VALIDATION)).serialize() )
	
	#return authentication
	return HttpResponse( AIResponse(data=auth).serialize() )