示例#1
0
    def create_usertools(self, user):
        """
        Creates an :class:`UserTools` instance for this user.

        :param user:
            Django :class:`User` instance.

        :return: The newly created :class:`UserTools` instance.

        """
        verification_key = generate_hash(user)
        return self.create(user=user, verification_key=verification_key)
示例#2
0
    def change_email(self, email):
        """
        Changes the email address for a user.

        A user needs to verify this new email address before it becomes
        active. By storing the new email address in a temporary field --
        ``temporary_email`` -- we are able to set this email address after the
        user has verified it by clicking on the verification URI in the email.
        This email gets send out by ``send_verification_email``.

        :param email:
            The new email address that the user wants to use.

        """
        self.email_unconfirmed = email

        self.email_confirmation_key = generate_hash(self.user)
        self.email_confirmation_key_created = now()
        self.save()

        # Send email for confirmation
        self.send_confirmation_email()
示例#3
0
    def change_email(self, email):
        """
        Changes the email address for a user.

        A user needs to verify this new email address before it becomes
        active. By storing the new email address in a temporary field --
        ``temporary_email`` -- we are able to set this email address after the
        user has verified it by clicking on the verification URI in the email.
        This email gets send out by ``send_verification_email``.

        :param email:
            The new email address that the user wants to use.

        """
        self.email_unconfirmed = email

        self.email_confirmation_key = generate_hash(self.user)
        self.email_confirmation_key_created = now()
        self.save()

        # Send email for confirmation
        self.send_confirmation_email()