Return to API Reference.
Uploads a mugshot for a user to the USERENA_MUGSHOT_PATH and saving it under unique hash for the image. This is for privacy reasons so others can’t just browse through the mugshot directory.
Userena model which stores all the nescessary information to have a full functional user implementation on your Django website.
Checks if activation key is expired.
Returns True when the activation_key of the user is expired and False if the key is still valid.
The key is expired when it’s set to the value defined in USERENA_ACTIVATED or activation_key_created is beyond the amount of days defined in USERENA_ACTIVATION_DAYS.
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 verfication URI in the email. This email get’s send out by send_verification_email.
Arguments
Sends a activation email to the user.
This email is send when the user wants to activate their newly created user. Also checks if the protocol is secured by looking at USERENA_USE_HTTPS value.
Sends an email to confirm the new email address.
This method sends out two emails. One to the new email address that contains the email_confirmation_key which is used to verify this this email address with UserenaUser.objects.confirm_email.
The other email is to the old email address to let the user know that a request is made to change this email address.
Base model needed for extra profile functionality
Meta options making the model abstract and defining permissions.
The model is abstract because it only supplies basic functionality to a more custom defined model that extends it. This way there is not another join needed.
We also define custom permissions because we don’t know how the model that extends this one is going to be called. So we don’t know what permissions to check. For ex. if the user defines a profile model that is called MyProfile, than the permissions would be add_myprofile etc. We want to be able to always check add_profile, change_profile etc.
Can the user view this profile?
Returns a boolean if a user has the rights to view the profile of this user.
Users are divided into four groups:
- Open
- Everyone can view your profile
- Closed
- Nobody can view your profile.
- Registered
- Users that are registered on the website and signed in only.
- Admin
- Special cases like superadmin and the owner of the profile.
Through the privacy field a owner of an profile can define what they want to show to whom.
Arguments
Returns the image containing the mugshot for the user.
The mugshot can be a uploaded image or a Gravatar.
Gravatar functionality will only be used when USERENA_MUGSHOT_GRAVATAR is set to True.
Returns None when Gravatar is not used and no default image is supplied by USERENA_MUGSHOT_DEFAULT.