websauna.system.user.schemas module

Colander schemas.

class websauna.system.user.schemas.ForgotPasswordSchema(*arg, **kw)[source]

Bases: websauna.system.form.csrf.CSRFSchema

Used on forgot password view.

class websauna.system.user.schemas.GroupSet(model=None, match_column=None, label_column=None)[source]

Bases: websauna.system.form.sqlalchemy.UUIDModelSet

A set of Group objects referred by their uuid.

get_model(node)[source]

Return Group class.

Parameters

node (SchemaNode) – Colander SchemaNode.

Return type

Type[InterfaceClass]

Returns

Class implementing IGroupModel.

class websauna.system.user.schemas.LoginSchema(*arg, **kw)[source]

Bases: websauna.system.form.csrf.CSRFSchema

Login form schema.

The user can log in both with email and his/her username, though we recommend using emails as users tend to forget their usernames.

websauna.system.user.schemas.PASSWORD_MIN_LENGTH = 6

Todo change to setting, convert to deferred widget

class websauna.system.user.schemas.RegisterSchema(*arg, **kw)[source]

Bases: websauna.system.form.csrf.CSRFSchema

Username-less registration form schema.

class websauna.system.user.schemas.ResetPasswordSchema(*arg, **kw)[source]

Bases: websauna.system.form.csrf.CSRFSchema

Reset password schema.

websauna.system.user.schemas.defer_group_class(node, kw)[source]

Colander helper deferred to assign the current group model.

Parameters
  • node (SchemaNode) – Colander SchemaNode

  • kw (dict) – Keyword arguments.

Return type

Type[InterfaceClass]

Returns

IGroupModel

websauna.system.user.schemas.email_exists(node, value)[source]

Colander validator that ensures a User exists with the email.

Parameters
  • node (SchemaNode) – Colander SchemaNode.

  • value (str) – Email address.

Raises

c.Invalid if email is not registered for an User.

websauna.system.user.schemas.group_vocabulary(node, kw)[source]

Convert all groups on the site to (uuid, name) tuples for checkbox and select widgets.

Parameters
  • node (SchemaNode) – Colander SchemaNode

  • kw (dict) – Keyword arguments.

Return type

List[Tuple[str, str]]

Returns

List of tuples with uuid, name for all groups on the site.

websauna.system.user.schemas.optional_group_vocabulary(node, kw)[source]

Convert all groups on the site to (uuid, name) tuples for checkbox and select widgets. Include a choice for no choice.

Parameters
  • node (SchemaNode) – Colander SchemaNode

  • kw (dict) – Keyword arguments.

Return type

List[Tuple[str, str]]

Returns

List of tuples with uuid, name for all groups on the site.

websauna.system.user.schemas.validate_unique_user_email(node, value, **kwargs)[source]

Make sure we cannot enter the same username twice.

Parameters
  • node (SchemaNode) – Colander SchemaNode.

  • value (str) – Email address.

  • kwargs (dict) – Keyword arguments.

Raises

c.Invalid if email address already taken.

websauna.system.user.schemas.validate_user_exists_with_email(node, value)[source]

Colander validator that ensures a User exists with the email.’

Parameters
  • node (SchemaNode) – Colander SchemaNode.

  • value (str) – Email address.

Raises

c.Invalid if email is not registered for an User.