HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers64/klimroosbudel.nl/wwwroot/kms/app/controllers/c_pass_updater.class.php
<?php
/**
 * c_pass_updater.class.php
 * Created by Komma Mediadesign.
 * Author: mike
 * Date: 4/26/13
 */
class Pass_Updater extends Controller
{
    public function __construct()
    {
        parent::__construct();
    }

    /*
     * New password form
     */
    public function index()
    {
        // Check if user is allowed to enter a new password
        if (Session::get('pass_update_act_hash')) {
            // Button
            $sbm = new Button(['type'=>'submit', 'name'=>'update_pass_submit', 'label'=>$this->View->lang['edit']]);
            $sbm->addClasses(['blue']);
            $this->View->setData('submit', $sbm->display(false));

            // Set Page Title
            $this->View->setData('page_title', 'New pass | '.SITE_NAME);
            $this->View->setData('body_id', 'body_login');
            $this->View->setData('background', '<div id="background"><img src="'.IMAGE_ROOT.'static/water.jpg" alt="Komma Mediadesign" /></div>');

            // Render the View
            $this->View->render('login/v_pass_new');
        } else {
        }
    }

    /*
     * Validate
     */
    public function validate()
    {
        $newPass = $_POST['new'];
        $confirmPass = $_POST['confirm'];

        if (! empty($newPass) && ! empty($confirmPass)) {
            if (! class_exists('Password')) {
                require_once DOCUMENT_ROOT.'lib/general/password.class.php';
            }

            $password = new Password([
                'minLength'      => 8,
                'maxLength'      => 30,
                'minNumbers'     => 1,
                'minLetters'     => 1,
                'minLowerCase'   => 1,
                'minUpperCase'   => 1,
                'minSymbols'     => 1,
                'maxSymbols'     => 10,
                'allowedSymbols' => ['#', '_', '-', '!', '?', '@', '[', ']', '=', '~', '*'], ]);

            // If password is valid
            if ($password->validatePassword($newPass)) {
                if ($newPass == $confirmPass) {
                    $this->Model->update($newPass, Session::get('pass_update_act_hash'));
                    $this->Functions->redirect(LANG_ROOT.'/');
                } else {
                    $errors[] = $this->View->lang['activation_passwords_do_not_match'];
                }
            } else {
                $errors = $password->getErrors();
            }
        } else {
            $errors[] = $this->View->lang['login_please_fill_both_forms'];
        }

        if (isset($errors)) {
            $this->Alert->set($errors, 'error');
        }
        $this->Functions->redirect(LANG_ROOT.$this->View->urls['pass_updater'].'/');
    }
}