Exemplo n.º 1
0
    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';
} elseif ($route->match('public', null)) {
    $view->layout = 'layout_public';
} elseif ($route->match('user', null)) {
    if (!$auth) {
        Ut::redirectTo(Ut::uri('home'), array('You are not authorized. Please login or create an account'));
    }
    $view->layout = 'layout_user';
} elseif ($route->match('usersession', null)) {