Ejemplo n.º 1
0
    $api->passwordConfirm();
    if ($api->getErrors()) {
        Ut::redirectTo(Ut::uri('report'), $api->getErrors());
        exit;
    }
    $view->view = 'passwordnew';
} elseif ($route->match('passwordupdate', null)) {
    // Check post
    if (!$_POST) {
        Ut::redirectTo(Ut::uri('report'), array('404 Page not found'));
        exit;
    }
    // Prepare and sanitize post input
    $api->setInputs($_POST);
    // Validation
    if (!Ut::strLenght($api->getInputVal('pw'), 6)) {
        $api->setErrors('Password must be min 6 characters length');
    }
    if ($api->getErrors()) {
        Ut::redirectTo(Ut::uri('passwordnew/' . $api->getInputVal('token')), $api->getErrors());
        exit;
    }
    // Update password
    $api->passwordUpdate();
    if ($api->getErrors()) {
        Ut::redirectTo(Ut::uri('report'), $api->getErrors());
        exit;
    }
    Ut::redirectTo(Ut::uri('home'), array('Your password was changed. Login with new password'), 'success');
} elseif ($route->match('report', null)) {
    $view->view = 'report';