mewlo.mpacks.core.user.musermanager module

musermanager.py

The helper manager for user model.

class mewlo.mpacks.core.user.musermanager.MewloUserManager(mewlosite, debugmode)[source]

Bases: mewlo.mpacks.core.manager.modelmanager.MewloModelManager

User model manager.

build_generic_user_verification(verification_type, user, request, fieldname, fieldval, extradict, is_shortcode, flag_invalidateprevious)[source]

Build a verification entry for a user field. return tuple (verification, failure)

build_userfield_verification(user, request, fieldname, fieldval, is_shortcode)[source]

Build a verification entry for a user field. return tuple (verification, failure)

calc_account_templatepath(viewfilepath)[source]

Template path inside user account site addon.

calc_verificationurl_field(verification, fieldname)[source]

The url user must visit to verify field change/initialization.

cancel_userfield_verifications(user, request, fieldname, invalidreason)[source]

Delete any previous field verification.

check_uniquefield_notinuse(user, fieldname, fieldval)[source]

If fieldname is a field that must be unique to a user, make sure no other user has this field value.

create_newuser_rbac_test(user)[source]

Build some test rbac stuff for a user.

create_user(request, userdict, verifiedfields)[source]

Make a new user account. We take a userdict instead of explicit variables for username, email, password, so that we can eventually accomodate whatever initial user properties we have specified at time of registration. return tuple (userobject, errordict); if there are errors return them and userobject as None

description = 'Handles the user database model'
error_if_user_exists(userdict)[source]

Return a dictionary of fieldname:error if the user exists, Otherwise return {}.

find_user_by_dict(userdict)[source]

Simple shortcut.

find_user_by_dict_with_field(userdict)[source]

Lookup user by a uniquely identifiable field in userdict (typically username or email). We use this general function so that we can expand to support looking up by phone numbers, etc. We have a list of fields that we know uniquely identify users and we check EACH of these in turn (not the combo of them all); when we find a match we return the user and the fieldname that matched. It is called during login (to identify the user logging in) and during registration (to check if the username or email, etc. is already in use). Return tupe of (user, matchingfieldname)

finduser_byid(userid)[source]

Just look up a user by their id.

getmake_guestuserobject()[source]

Make a guest user object and return it. Ultimately I think that “making” a guest user object, should probably involve loading a specific guest user account from database. ATTN: unfinished.

hash_and_salt_password(password_plaintext)[source]

Return a hashed and salted version of the password, suitable for database storage.

login_user(userdict)[source]

Make a new user account. return tuple (userobject, errordict) IMPORTANT: if there are errors return userobject as None (and set errordict)

send_field_verification_email(user, request, emailaddress)[source]

Send an email verification.

send_field_verification_email_given_verification(verification, fieldname, emailaddress)[source]

Send a verification email.

send_field_verifications(user, request, verifiedfields)[source]

This is generally called right after saving a new user who needs to be sent an email verification.

send_onefield_verification(user, request, fieldname, fieldval)[source]

Send user a field verification message. Typically this is for email. Return failure.

set_userfield_from_verification(verification)[source]

The user specified in the verification gets the new value, which is marked as verified.

set_userpassword_from_plaintext(user, password_plaintext)[source]

set hashed password.

startup_prep(stageid, eventlist)[source]

This is invoked by site strtup, for each stage specified in startup_stages_needed() above.

Table Of Contents

Previous topic

mewlo.mpacks.core.user.muser module

Next topic

mewlo.mpacks.core.verification package

This Page