DADA::Profile::Session

NAME

DADA::Profile::Session

SYNOPSIS

DESCRIPTION

Public Methods

new

        my $prof_sess = DADA::Profile::Session->new

new returns a DADA::Profile::Session object.

new does not take any parameters and returns a DADA::Profile::Session object.

login

        my $cookie = $prof_sess->login(
                { 
                        -email    => scalar $q->param('email'),
                        -password => scalar $q->param('password'), 
                },
        );

login saves the session information for the profile, as well as returns a cookie, so that the state can be fetched later.

It requires two arguments:

-email should hold the email address associated with the profile that you'd like to login.

-password should hold the correct password associated with the user.

This method will croak if the login information (user/password) is incorrect. Use validate_profile_login() before trying to login.

logout

 $prof_sess->logout;

logout removes the session state information. It'll return 1 on success and 0 on failure. Usually, a failure will happen if the profile is not actually logged in.

validate_profile_login

        my ($status, $errors) = $prof_sess->validate_profile_login(
                { 
                        -email    => scalar $q->param('email'),
                        -password => scalar $q->param('password'), 
                
                },
        );

validate_profile_login is used to make sure the login information you give is valid.

It requires two parameters:

-email should be the email address associated with the profile.

-password should be the profile associated with the profile.

It'll return a two-element array. The first is the status and will be set to either, 1 or 0, with 1 meaning that no problems were encountered. If the status is set to, 0, then problems were encountered. Any problems will be described in the second element of the array. This should be a hashref of key/value pairs. The keys will describe the error and the value would be set to, 1 if the error was found.

Here's the following keys that may be returned:

is_logged_in

 my $logged_in = $prof_sess->is_logged_in; 

is_logged_in returns 1 if a profile is logged in, or 0 if it is not.

is_logged_in does not need any arguments.

get

 my $email = $prof_sess->get; 

get returns the email address associated with the profile that is logged in.

Most likely, if the profile is not logged in, undef will be returned.

AUTHOR

Justin Simoni https://dadamailproject.com

LICENSE AND COPYRIGHT

Copyright (c) 1999 - 2023 Justin Simoni All rights reserved.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.


Dada Mail Project

Download

Installation

Support