File: D:/HostingSpaces/SBogers64/klimroosbudel.nl/wwwroot/kms/app/controllers/c_forgot_pass.class.php
<?php
/**
* c_forgot_pass.class.php
* Created by Komma Mediadesign.
* Author: mike
* Date: 4/26/13
*/
class Forgot_Pass extends Controller
{
public function __construct()
{
parent::__construct();
}
/*
* Shows the page forgot pass
*/
public function index()
{
// Create Submit Button and send data to the view
$sbm = new Button(['type'=>'submit', 'name'=>'send_pass_submit', 'label'=>$this->View->lang['send']]);
$sbm->addClasses(['blue']);
$this->View->setData('submit', $sbm->display(false));
// Set Page Title
$this->View->setData('page_title', 'Forgot 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_forgot_pass');
}
/*
* Validates the email address the user entered
* @return array
*/
public function validate()
{
$email = $_POST['email'];
if (! empty($email)) {
$Db = new DatabaseHandler();
$Db->setTableName('kms_admin');
$Db->addRule('email', $email);
if ($user = $Db->select()) {
Session::set('activation_user', $user);
$this->Functions->redirect(LANG_ROOT.$this->View->urls['pass_activation'].'/send/');
} else {
$errors[] = $this->View->lang['activation_user_not_found'];
$this->Alert->set($errors, 'error');
$this->Functions->redirect(LANG_ROOT.URL_PAGE.'/');
}
} else {
$errors[] = $this->View->lang['form_complete_all_fields'];
$this->Alert->set($errors, 'error');
$this->Functions->redirect(LANG_ROOT.URL_PAGE.'/');
}
return false;
}
}