Created
September 26, 2013 18:55
-
-
Save cirocosta/6718886 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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