NAME

Interchange6::Schema::Result::User

ACCESSORS

users_id

Primary key.

username

The username is automatically converted to lowercase so we make sure that the unique constraint on username works.

nickname

Unique nickname for user.

email

email address.

password

See DBIx::Class::PassphraseColumn and its dependency Authen::Passphrase for full details of supported password encodings.

New/changed passwords are currently encoded using Authen::Passphrase::BlowfishCrypt using 2^14 rounds and random salt.

Check password method is check_password.

Default value is '{CRYPT}*' which causes check_password to fail.

first_name

User's first name.

last_name

User's last name.

last_login

Last login returned as DateTime object. Updated on successful call to check_password.

fail_count

Count of failed logins since last successful login. On successful call to check_password gets reset to zero but on fail is incremented.

reset_expires

Date and time when "reset_token" expires.

reset_token

Used to store password reset token.

is_anonymous

Boolean denoting an anonymous user. Defaults to 0 (false);

created

Date and time when this record was created returned as DateTime object. Value is auto-set on insert.

last_modified

Date and time when this record was last modified returned as DateTime object. Value is auto-set on insert and update.

active

Is this user account active? Default is yes.

RELATIONS

addresses

Type: has_many

Related object: Interchange6::Schema::Result::Address

carts

Type: has_many

Related object: Interchange6::Schema::Result::Cart

orders

Type: has_many

Related object: Interchange6::Schema::Result::Order

user_attributes

Type: has_many

Related object: Interchange6::Schema::Result::UserAttribute

user_roles

Type: has_many

Related object: Interchange6::Schema::Result::UserRole

roles

Type: many_to_many

Composing rels: "user_roles" -> role

approvals

Type: has_many

Related object: Interchange6::Schema::Result::Message FK approved_by_users_id

messages

Type: has_many

Related object: Interchange6::Schema::Result::Message FK author_users_id

METHODS

Attribute methods are provided by the Interchange6::Schema::Base::Attribute class.

sqlt_deploy_hook

Called during table creation to add indexes on the following columns:

  • reset_token

reset_token_generate( %args );

Arguments should be a hash of the following key/value pairs:

  • duration => $datetime_duration_hashref

    Value should be a hash reference containing values that can be passed directly to "new" in DateTime::Duration. Passing an undef value to duration will lead to the creation of a reset token that does not expire. Default duration is 24 hours.

  • entropy => $number_of_bits

    The number of bits of entropy to be used by "new" in Session::Token. Defaults to 128.

This method sets "reset_expires" and "reset_token" and returns the value of "reset_token" with checksum added.

reset_token_checksum

Returns the checksum for the token stored in "reset_token".

Checksum is a digest of "password", "reset_token" and "reset_expires" (if this is defined). This ensures that a reset token is not valid if password has changed or if a newer token has been generated.

reset_token_verify

When passed combined token and checksum as argument returns 1 if token and checksum are correct and "reset_expires" is not in the past (if it is defined). Returns 0 on failure.

new

Overloaded method.

If "username" is undefined and "is_anonymous" is defined then create a unique username for this anonymous user and set "active" to false. Otherwise check username using "check_username".

insert

Overloaded method. Always add new users to Role with name 'user' unless user has "is_anonymous" set in which case add user to role 'anonymous';

update

Overloaded method. Check username using "check_username" if supplied.

check_username( $username )

Die if $username is undef or empty string. Otherwise return lc($username)

blog_posts

Returns resultset of messages that are blog posts (Message->type eq 'blog_post')

name

Returns "first_name" and "last_name" joined by a single space.

reviews

Returns resultset of messages that are reviews (referenced by ProductReview class).