NAME
Authen::UserVerify - Generate and verify unique codes to be used to authenticate users one time without using a password to:
- 1. Verify user email address
- 2. Set first-time user password
- 3. Reset password via email
- 4. Confirm users registration
- 5. Get user details first time
EXAMPLE
# Getting a code
my $user = "terence"
my $email = "..";
my $reg = UserReg->new;
my $code = $reg->add("CONFIRM_REG", $user, $email);
my $url = $curr_url . "?code=$code";
# mail url to user
# Read $code from url
if ($reg->has($code)) { # Verifying the code
my ( $type, $user, $email ) = $reg->get($code);
if ( "CONFIRM_REG" eq $type ) {
$reg->delete($code); # invalidate the code
init_session($user);
show_reg_form();
}
} else {
# The code is invalid
}
METHODS
new
Create a new UserReg object
get
Fetch user info for the given code
add
Add the user entry
has
Check if the code is present
delete
Remove the entry
CAVEATS
Multi-line data (with newlines in between) cannot be added
AUTHOR
Terence Monteiro terence AT deeproot DOT in
CREDITS
Nivedita Mukherjee, for testing out concepts in a CGI application
Alok for reviewing the code
Ricardo and Stephan for suggestions on #email at irc.perl.org
LICENSE
This module is free software; you can distribute it and/or modify it under the same terms as Perl itself