Registration

These interfaces and implementations control the user registration flow in FlaskBB.

Registration Interfaces

class flaskbb.core.auth.registration.UserRegistrationInfo(username, password, email, language, group)[source]

User registration object, contains all relevant information for validating and creating a new user.

class flaskbb.core.auth.registration.UserValidator[source]

Used to validate user registrations and stop the registration process by raising a ValidationError.

validate(user_info)[source]

This method is abstract.

Parameters:user_info (UserRegistrationInfo) – The provided registration information.
class flaskbb.core.auth.registration.UserRegistrationService[source]

Used to manage the registration process. A default implementation is provided however, this interface is provided in case alternative flows are needed.

register(user_info)[source]

This method is abstract.

Parameters:user_info (UserRegistrationInfo) – The provided user registration information.
class flaskbb.core.auth.registration.RegistrationFailureHandler[source]

Used to handle failures in the registration process.

handle_failure(user_info, failures)[source]

This method is abstract.

Parameters:
  • user_info (UserRegistrationInfo) – The provided registration information.
  • failures – Tuples of (attribute, message) from the failure
class flaskbb.core.auth.registration.RegistrationPostProcessor[source]

Used to post proccess successful registrations by the time this interface is called, the user has already been persisted into the database.

post_process(user)[source]

This method is abstract.

Parameters:user (User) – The registered, persisted user.

Registration Provided Implementations

class flaskbb.auth.services.registration.UsernameRequirements(min, max, blacklist)[source]

Configuration for username requirements, minimum and maximum length and disallowed names.

class flaskbb.auth.services.registration.UsernameValidator(requirements)[source]

Validates that the username for the registering user meets the minimum requirements (appropriate length, not a forbidden name).

class flaskbb.auth.services.registration.UsernameUniquenessValidator(users)[source]

Validates that the provided username is unique in the application.

class flaskbb.auth.services.registration.EmailUniquenessValidator(users)[source]

Validates that the provided email is unique in the application.

class flaskbb.auth.services.registration.SendActivationPostProcessor(account_activator)[source]

Sends an activation request after registration

Parameters:account_activator (AccountActivator) –
class flaskbb.auth.services.registration.AutologinPostProcessor[source]

Automatically logs a user in after registration

class flaskbb.auth.services.registration.AutoActivateUserPostProcessor(db, config)[source]

Automatically marks the user as activated if activation isn’t required for the forum.

Parameters:
  • db – Configured Flask-SQLAlchemy extension object
  • config – Current flaskbb configuration object
class flaskbb.auth.services.registration.RegistrationService(plugins, users, db)[source]

Default registration service for FlaskBB, runs the registration information against the provided validators and if it passes, creates the user.

If any of the provided UserValidators raise a ValidationError then the register method will raise a StopValidation with all reasons why the registration was prevented.