File: D:/HostingSpaces/SBogers18/decoockpit.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(array('type'=>'submit','name'=>'update_pass_submit','label'=>$this->View->lang['edit']));
$sbm->addClasses(array('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(array(
'minLength' => 8,
'maxLength' => 30,
'minNumbers' => 1,
'minLetters' => 1,
'minLowerCase' => 1,
'minUpperCase' => 1,
'minSymbols' => 1,
'maxSymbols' => 10,
'allowedSymbols' => array('#', '_', '-', '!', '?', '@', '[', ']', '=', '~', '*'),));
// 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'] . '/');
}
}