示例#1
0
 def save(self, commit=True):
     user = super(SRPUserCreationForm, self).save(commit=False)
     user.password = UNUSABLE_PASSWORD
     srpinfo = SRPUserInfo()
     srpinfo.verifier = self.cleaned_data['verifier']
     srpinfo.salt = self.cleaned_data['salt']
     srpinfo.srp_group = self.cleaned_data['srp_group']
     if commit:
         user.save()
         srpinfo.user = user
         srpinfo.save()
     return user
示例#2
0
文件: forms.py 项目: sqs/safebook
 def save(self, commit=True):
     user = super(SRPUserCreationForm, self).save(commit=False)
     user.password = UNUSABLE_PASSWORD
     srpinfo = SRPUserInfo()
     srpinfo.verifier = self.cleaned_data["verifier"]
     srpinfo.salt = self.cleaned_data["salt"]
     srpinfo.srp_group = self.cleaned_data["srp_group"]
     if commit:
         user.save()
         srpinfo.user = user
         srpinfo.save()
     return user
示例#3
0
 def handle(self, *args, **options):
     if len(args) != 2:
         raise CommandError("must specify username and password")
     username = args[0]
     password = args[1]
     try:
         user = User.objects.get(username=username)
     except User.DoesNotExist:
         user = User(username=username, password=UNUSABLE_PASSWORD)
         user.save()
     try:
         srpinfo = SRPUserInfo.objects.get(user=user)
     except SRPUserInfo.DoesNotExist:
         srpinfo = SRPUserInfo(user=user)
     srpinfo.set_from_password(password)
     srpinfo.save()
示例#4
0
 def handle(self, *args, **options):
     if len(args) != 2:
         raise CommandError("must specify username and password")
     username = args[0]
     password = args[1]
     try:
         user = User.objects.get(username=username)
     except User.DoesNotExist:
         user = User(username=username, password=UNUSABLE_PASSWORD)
         user.save()
     try:
         srpinfo = SRPUserInfo.objects.get(user=user)
     except SRPUserInfo.DoesNotExist:
         srpinfo = SRPUserInfo(user=user)
     srpinfo.set_from_password(password)
     srpinfo.save()