The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

MKDoc::Auth::User - Simple user class for MKDoc::Auth

API

$class->sql_table();

Returns the MKDoc::SQL::Table object associated with this class. This object represents the table in which MKDoc::Auth::User objects are stored.

$class->sql_name();

Returns the name of the SQL table in which MKDoc::Auth::User objects are stored.

$class->sql_schema();

Instanciates and returns the MKDoc::SQL::Table object in which MKDoc::Auth::User objects are stored.

$class->max_login_length();

The maximum length of the login field.

$class->min_login_length();

The minimum length of the login field.

$class->max_password_length();

The maximum length of the password.

$class->min_password_length();

The minimum length of the password.

$self->validate();

Validates this object. For each error encountered, instanciates MKDoc::Core::Error objects. If you are using a MKDoc::Core::Plugin object.

Possible error flags:

auth/user/id/undefined - The object is not new, but it has no ID field
auth/user/id/no_match - The object is not new, but its ID field was not in the database
auth/user/login/empty - This object Login attribute is empty
auth/user/login/too_short - This object Login attribute is too short
auth/user/login/loo_long - This object Login attribute is too long
auth/user/login/exists - This object is new, but the login already exists in the database
auth/user/login/changed - This object is not new. Its login cannot be changed
auth/user/password/empty - This object 'Password_1' attribute is empty
auth/user/password/too_short - This object 'Password_1' attribute is too short
auth/user/password/too_long - This object 'Password_1' attribute is loo long
auth/user/password/mismatch - This object 'Password_1' and 'Password_2' attributes do not match
auth/user/password/empty - No password was set for this object
auth/user/email/empty - This object 'Email' attribute is empty
auth/user/email/invalid - This object 'Email' attribute is not valid
auth/user/full_name/empty - This object 'Full_Name' attribute is undefined or empty
auth/user/full_name/too_short - This object 'Full_Name' attribute is too short
auth/user/full_name/too_long - This object 'Full_Name' attribute is too long

$class->new (%args);

Creates a new MKDoc::Auth::User object. %args must be:

  email      => $email_address,
  full_name  => $full_name,
  password_1 => $user_password,
  password_2 => $user_password,

The 'email' argument will also be used as the login of the user.

$class->list();

Returns all MKDoc::Auth::User objects which have been saved.

$class->load ($id);

Returns the MKDoc::Auth::User object from its object id.

$class->load_from_login ($login);

Returns the MKDoc::Auth::User object with login $login.

$class->find_from_email ($email);

Finds all the users whose email address is matching $email.

$self->save();

Saves the object into the database. If the object is new, inserts it. Otherwise updates it.

$self->delete();

Deletes the object from the database.

$self->id();

Returns the identifier of this object.

$self->login();

Returns the Login attribute of this object.

$self->set_login ($login);

Sets the Login attribute for this object.

$self->password_1();

Returns the proposed new password of this object.

$self->set_password_1 ($new_password);

Sets the proposed new password for this object.

$self->password_2();

Returns the proposed new password verification of this object.

$self->set_password_2 ($new_password_verify);

Sets the proposed new password verification for this object.

$self->password();

Returns the encrypted password of this object.

$self->set_password();

Sets the encrypted password of this object.

$self->check_password ($pass);

Checks wether the encrypted $pass matches $self->password().

$self->full_name();

Returns the full name of this object.

$self->set_full_name ($full_name);

Sets the full name of this object.

$self->email();

Returns the email of this object.

$self->set_email ($email);

Sets the email of this object.

$self->crypt_and_set_temp_password ($clear_password);

Encryps $clear_password and sets it as a temporary password.

$self->set_temp_password ($crypted_pass);

Sets the encrypted password of this object.

$self->temp_password();

Gets the encrypted password of this object.

$self->check_temp_password ($pass);

Checks wether the encrypted $pass matches $self->temp_password().

$self->delete_temp_password();

Deletes the current temporary password.