def save(self, commit=True): user = super(UserCreationForm, self).save(commit=False) user.set_password(self.cleaned_data["password1"]) user.token = get_token(user.uuid.urn.__str__()) if commit: user.save() return user
def create_user(self, username, password=None): user = self.model(username=username, ) user.set_password(password) user.token = get_token(user.uuid.urn.__str__()) user.save(using=self._db) return user
def get_user(self, refresh=True): uo = User.objects user = uo.get(token=self.data.get('token')) if refresh: user.token = get_token(user.uuid.urn.__str__()) user.save() return user
def get_user(self): uo = User.objects user = uo.get(username=self.data.get('username')) if check_password(self.data.get('password'), user.password): user.token = get_token(user.uuid.urn.__str__()) user.save() return user else: raise User.DoesNotExist
def save(self, commit=True): uo = User.objects if uo.filter(username=self.data.get('username')).exists(): raise SameError('유저 이름') user = super(RegisterForm, self).save(commit=False) user.set_password(self.clean_password2()) user.token = get_token(user.uuid.urn.__str__()) if commit: user.save() return user