Ejemplo n.º 1
0
 public static function read()
 {
     $types = Session::get('messages');
     // no messages no problem
     if (is_null($types)) {
         return '';
     }
     $html = '';
     foreach ($types as $type => $messages) {
         foreach ($messages as $message) {
             $html .= sprintf(static::$mwrap, $type, implode('<br>', (array) $message));
         }
     }
     Session::erase('messages');
     return sprintf(static::$wrap, $html);
 }
Ejemplo n.º 2
0
    } catch (Exception $e) {
        Input::flash();
        Notify::error($e->getMessage());
        return Response::redirect('account');
    }
    return Response::redirect('complete');
}));
/*
    Complete
*/
Route::get('complete', function () {
    // check we have a database
    if (!Session::get('install')) {
        Notify::error('Please select your language');
        return Response::redirect('start');
    }
    $settings = Session::get('install');
    $vars['site_uri'] = $settings['metadata']['site_path'];
    $vars['admin_uri'] = rtrim($settings['metadata']['site_path'], '/') . '/index.php/admin/login';
    $vars['htaccess'] = Session::get('htaccess');
    // scrub session now we are done
    Session::erase('install');
    file_put_contents(APP . 'install.lock', time());
    return Layout::create('complete', $vars);
});
/*
    404 catch all
*/
Route::any(':all', function () {
    return Response::error(404);
});
Ejemplo n.º 3
0
 private static function logout()
 {
     $session = new Session();
     $session->erase('_user');
     $session->destroy();
     return self::loginview();
 }
 public static function logout()
 {
     Session::erase(static::$session);
 }
Ejemplo n.º 5
0
    $token = Session::get('token');
    $user = Session::get('user');
    if ($token != $key) {
        Notify::error(__('users.recovery_expired'));
        return Response::redirect('admin/login');
    }
    $validator = new Validator(array('password' => $password));
    $validator->check('password')->is_max(6, __('users.password_too_short', 6));
    if ($errors = $validator->errors()) {
        Input::flash();
        Notify::error($errors);
        return Response::redirect('admin/reset/' . $key);
    }
    User::update($user, array('password' => Hash::make($password)));
    Session::erase('user');
    Session::erase('token');
    Notify::success(__('users.password_reset'));
    return Response::redirect('admin/login');
}));
/*
	Upgrade
*/
Route::get('admin/upgrade', function () {
    $vars['messages'] = Notify::read();
    $vars['token'] = Csrf::token();
    $version = Config::meta('update_version');
    $url = 'https://github.com/anchorcms/anchor-cms/archive/%s.zip';
    $vars['version'] = $version;
    $vars['url'] = sprintf($url, $version);
    return View::create('upgrade', $vars)->partial('header', 'partials/header')->partial('footer', 'partials/footer');
});
Ejemplo n.º 6
0
 public static function logout()
 {
     Session::erase('user');
 }