#!/usr/bin/perl # Libraries use strict; use lib '../../propslib'; use vars qw(%c); use PropsConfig ( ) ; *c = \%PropsConfig::c; use Authen::Users; use CGI qw/:push/; # Global Constants my $props_group = 'props'; # Global Constructors my $q = new CGI; my $auth = new Authen::Users(dbtype => 'SQLite', dbname => "$c{PROPS_REL_PATH}/$c{PROPS_USERS_DB}"); # Global Variables $q->import_names('in'); # Sanitize Inputs $in::answer = CGI::escape($in::answer); $in::email = CGI::escape($in::email); $in::email =~ s/%40/\@/; print $q->header; if ($in::Action eq 'Challenge') { # Check Required Fields if ( !$in::email ) { print qq[
]; print qq[

Failed

Email Address is Required

]; print qq[
]; } else { if ($auth->is_in_table($props_group, $in::email)) { my ($question, $answer) = $auth->get_user_question_answer($props_group, $in::email); print qq[

Success

]; print <

Your security question: $question

Reset Password EOHTML } else { print qq[
]; print qq[

Failed

]; print qq[

]; } } } elsif ($in::Action eq 'Reset') { # Check Required Fields if ( !$in::email || !$in::answer || !$in::password) { print qq[
]; print qq[

Failed

All Fields Are Required

]; print qq[
]; } else { if ($auth->is_in_table($props_group, $in::email)) { my ($question, $answer) = $auth->get_user_question_answer($props_group, $in::email); if ($answer eq $in::answer) { $auth->update_user_password($props_group, $in::email, $in::password); print qq[
]; print qq[

Success

Password updated.

]; print qq[
]; } else { print qq[
]; print qq[

Failed

Incorrect answer.

]; print qq[
]; } } } } else { print < Props Password Reset

Props Password Reset

Recover Security Question

Login | Register Account

EOHTML }