require_once "web/includes/cnurls.php";
require_once "api/CNMessaging/CNMessageDispatcher.php";
// if user is logged in (and has entered their password recently) redirect to the User's page
if (isset(PA::$login_uid) && isset($_SESSION['login_source']) && $_SESSION['login_source'] == 'password' && empty($_GET['action']) && empty($_GET['enable']) && empty($_GET['auth']) && empty($_GET['openid_mode']) && empty($_GET['GInvID'])) {
    $location = PA::$url . PA_ROUTE_USER_PRIVATE;
    header("Location: {$location}");
    exit;
}
require_once "api/CNConfigurableText/CNConfigurableText.php";
// middle content
if (isset($_POST['submit'])) {
    //this is code for forgot password
    $error = FALSE;
    $email_pass = User::get_user_data($_POST['email']);
    if ($email_pass['email_exist'] == TRUE) {
        User::send_email_to_change_password($_POST['email']);
    } else {
        $error = TRUE;
    }
}
if (!empty($_SESSION['user']['id']) && (isset($_GET['action']) && $_GET['action'] == 'accept') && !empty($_GET['token'])) {
    $token = NULL;
    if (!empty($_GET['token'])) {
        $token = $_GET['token'];
        try {
            $token_arr = authenticate_invitation_token($token);
        } catch (CNException $e) {
            $token_arr[1] = "{$e->message}";
        }
    }
    //write description of the case
 public function handlePOST_forgotPasswordSubmit($request_data)
 {
     global $error_msg;
     $msg = NULL;
     if (isset($request_data['submit'])) {
         //     echo "POST";
         $error = FALSE;
         $this->is_post_set = TRUE;
         $this->email = trim($request_data['email']);
         $l_name = trim($request_data['login_name']);
         // case when Both are Empty
         if (empty($this->email) && empty($l_name)) {
             $msg = __('Please enter your email address or login name.');
             $error = TRUE;
         }
         // Case when Both are filled
         if (!empty($this->email) && !empty($l_name)) {
             $msg = __('Please enter either email or Login name');
             $error = TRUE;
         }
         // case when single field is field
         if (!$error) {
             if (!empty($this->email)) {
                 $val = Validation::validate_email($this->email);
                 if (empty($val)) {
                     $msg = __("Invalid email address.  Please try again.");
                     $error = TRUE;
                 }
             }
             if (!$error) {
                 $usr = new User();
                 try {
                     !empty($this->email) ? $usr->load($this->email, 'email') : $usr->load($l_name, 'login_name');
                     User::send_email_to_change_password($usr->email);
                     $msg = urlencode(__("A link has been e-mailed to you to let you change your password.  Thanks!"));
                 } catch (PAException $e) {
                     $msg = "{$e->message}";
                     $error = TRUE;
                 }
             } else {
                 $msg = nl2br(sprintf(__("There are no accounts in our system with the e-mail address %s.\n              If you have spelled the address incorrectly or entered the wrong address, please try again."), $this->email));
                 $error = TRUE;
             }
         }
     }
     //    $error_msg = $msg;
     $this->controller->redirect(PA::$url . "/login.php?msg={$msg}");
     /*    
         $msg_array = array();
         $msg_array['failure_msg'] = $msg;
         $msg_array['success_msg'] = NULL;
         $redirect_url = NULL;
         $query_str = NULL;
         set_web_variables($msg_array, $redirect_url, $query_str); 
     */
 }
Example #3
0
        $error = TRUE;
    }
    // case when single field is field
    if (!$error) {
        if (!empty($email)) {
            $val = validate_email($email);
            if (empty($val)) {
                $msg = __("Invalid email address.  Please try again.");
                $error = TRUE;
            }
        }
        if (!$error) {
            $usr = new User();
            try {
                !empty($email) ? $usr->load($email, 'email') : $usr->load($l_name, 'login_name');
                User::send_email_to_change_password($usr->email);
            } catch (PAException $e) {
                $msg = "{$e->message}";
                $error = TRUE;
            }
        } else {
            $msg = "<br>" . nl2br(sprintf(__("There are no accounts in our system with the e-mail address <font color=\"blue\">%s</font>.\n      \n      If you have spelled the address incorrectly or entered the wrong address, please try again."), $_form['email']));
            $error = TRUE;
        }
    }
}
$msg_array = array();
$msg_array['failure_msg'] = $msg;
$msg_array['success_msg'] = NULL;
$redirect_url = NULL;
$query_str = NULL;