Ejemplo n.º 1
0
 def clean_old_password(self):
     """
     Validates that the old_password field is correct.
     """
     old_password = self.cleaned_data["old_password"]
     remote_user = RestUser(self.user.username)
     if not remote_user.check_login({'password': old_password}):
         raise forms.ValidationError(_("Your old password was entered incorrectly. Please enter it again."))
     return old_password
Ejemplo n.º 2
0
 def authenticate(self, username=None, password=None):
     """foo"""
     
     remote_user = RestUser(username)
     login_result = remote_user.check_login({'password':password})
     if not 'errorMessage' in login_result:
         try:
             user = User.objects.get(username=username)
         except User.DoesNotExist:
             # user will have an empty password
             user = User.objects.create_user(username, '')
             user.save()
         return user
     return None