def save(self): # check Form validation. user = User.objects.create_user( username=self.cleaned_data['username'], email=self.cleaned_data['email'], password=self.cleaned_data['password1']) user.save() # activation activation_key = utils.create_activation_key(user, user.email) key_expires = utils.create_expire_date() new_user = UserProfile(user=user, activation_key=activation_key, key_expires=key_expires, is_verified=False) new_user.save() # send_activation email email_subject = 'SerdarsBlog - Confirmation for Your New Account' email_body = ('Hello! Thanks for registering for the blog \n' 'In order to active your account,' 'click following link in the next 48 hours: \n' 'http://*****:*****@serdardalgic.org', [user.email])
def save(self, user): userProfile = UserProfile.objects.get(user=user) userProfile.activation_key = utils.create_activation_key( user, self.cleaned_data["new_email_address"]) userProfile.key_expires = utils.create_expire_date() userProfile.save() self.send_verification(userProfile)