Created
March 2, 2012 16:09
-
-
Save ydnax/1959366 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
from django.contrib.auth import login,logout,authenticate | |
#viel code dazwischen | |
def login(request, loginid): | |
try: | |
user=UserProfile.objects.filter(mailcode=loginid)[0].user | |
newpass=id_generator(50) | |
user.set_password(newpass) | |
user.save() | |
authenticated=authenticate(username=user.username, password=newpass) | |
login(request, authenticated) | |
return HttpResponseRedirect(reverse('store')) | |
except IndexError: | |
return "blub" | |
return render_to_response('template_error.html', { | |
'title' : 'Error', | |
'text' : 'Dieser Loginlink scheint ungueltig zu sein.'}, | |
context_instance=RequestContext(request)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment