-
-
Save john5223/66a18132c9c39b6e37eb to your computer and use it in GitHub Desktop.
Login.clean
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
try: | |
reg_fields = ['username', 'password', 'region', 'domain'] | |
d = self.cleaned_data | |
extra = {k:v for k,v in d.iteritems() if k not in reg_fields } | |
self.user_cache = authenticate(request=self.request, | |
username=username, | |
password=password, | |
user_domain_name=domain, | |
auth_url=region, | |
**extra) | |
msg = 'Login successful for user "%(username)s".' % \ | |
{'username': username} | |
LOG.info(msg) | |
except exceptions.KeystoneAuthException as exc: | |
msg = 'Login failed for user "%(username)s".' % \ | |
{'username': username} | |
LOG.warning(msg) | |
raise forms.ValidationError(exc) | |
if hasattr(self, 'check_for_test_cookie'): # Dropped in django 1.7 | |
self.check_for_test_cookie() | |
return self.cleaned_data |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment