Skip to content

Instantly share code, notes, and snippets.

@cirocosta
Created September 26, 2013 18:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cirocosta/6718886 to your computer and use it in GitHub Desktop.
Save cirocosta/6718886 to your computer and use it in GitHub Desktop.
@csrf_exempt
def seclogin(request):
key_usuario = request.POST['param0']
cipherpass = request.POST['param1']
print key_usuario
print cipherpass
aluno = Aluno.objects.get(key_usuario=key_usuario)
privk = getPrivate(aluno.privatekey)
senha = privk.decrypt(cipherpass)
print senha
user = authenticate(username=key_usuario, password=senha)
if user is not None:
if user.is_active:
login(request, user)
return HttpResponse("Conta desativada")
else:
return HttpResponse("Login inválido")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment