public function __construct() { parent::__construct(); $this->prependSiteTitle(lang('Log in')); if (ModelUser::isLoggedIn()) { $this->setMessage(lang('Welcome back ' . ModelUser::current()->data->name), 'success', 'main'); redirect(url('controlpanel.home')); } if ($this->isPostBack()) { $this->post->email->addValidation([new ValidateInputNotNullOrEmpty(), new ValidateInputEmail()]); if (!$this->hasErrors()) { try { $user = ModelUser::getByUsername($this->input('email')); if ($user->hasRow() && !$user->getEmailConfirmed()) { $this->setError(lang('Please confirm your e-mail.')); response()->refresh(); } ModelUser::authenticate($this->input('email'), $this->input('password')); } catch (UserException $e) { $this->setError($e->getMessage()); } if (!$this->hasErrors()) { redirect(url('controlpanel.organisations')); } } } }
public function __construct() { parent::__construct(); // Extending this class requires the user to be authenticated if (!ModelUser::isLoggedIn()) { $this->setMessage('This page can only be viewed when logged in', 'warning', 'main'); redirect(url('user.login'), 301); } $this->currentUser = ModelUser::current(true); $this->getSite()->addWrappedCss('bootstrap.css'); $this->getSite()->addWrappedCss('bootstrap-theme.css'); $this->getSite()->addWrappedCss('starter-template.css'); $this->getSite()->addWrappedJs('jquery.min.js'); $this->getSite()->addWrappedJs('global.js'); $this->sidemenu = new Menu(); $this->sidemenu->addItem(lang('Sources'), url('controlpanel.source')); $this->sidemenu->addItem(lang('Invoices'), url('controlpanel.invoices')); $this->sidemenu->addItem(lang('Payment'), url('controlpanel.payment')); $this->sidemenu->addItem(lang('Account'), url('controlpanel.account')); //$this->sidemenu->addItem(lang('Statistics'), url('controlpanel.statistic')); $this->mainMenu->addItem(lang('Organisations'), url('controlpanel.organisations')); if ($this->currentUser->admin_level > 0) { $this->mainMenu->addItem(lang('Admin'), url('admin.home')); } $this->mainMenu->addItem(lang('Sign out'), url('user.signout')); $this->setTemplate('Controlpanel.php'); $this->activeOrganisation = request()->organisation; }
public function __construct() { parent::__construct(); // Extending this class requires the user to be authenticated if (!ModelUser::isLoggedIn()) { $this->setMessage('This page can only be viewed when logged in', 'warning', 'main'); redirect(url('home'), 301); } $this->currentUser = ModelUser::current(); }
public function __construct() { parent::__construct(); $this->prependSiteTitle(lang('Administration')); // Extending this class requires the user to be authenticated if (!ModelUser::isLoggedIn() || ModelUser::isLoggedIn() && ModelUser::current()->admin_level < 1) { $this->setMessage('You need special permissions to view this page', 'warning', 'main'); redirect(url('user.login'), 301); } $this->sidemenu = new Menu(); $this->sidemenu->addItem(lang('Home'), url('admin.home')); $this->sidemenu->addItem(lang('Payments'), url('admin.payment')); $this->sidemenu->addItem(lang('Settings'), url('admin.settings')); }
public function handle(Request $request) { $this->request = $request; // Extending this class requires the user to be authenticated if (!ModelUser::isLoggedIn()) { $this->setMessage('This page can only be viewed when logged in', 'warning', 'main'); redirect(url('home'), 301); } $this->request->user = ModelUser::current(); $this->validateOrganisation(); if ($this->request->user->getActiveOrganisation()) { $this->request->organisation = ModelOrganisation::getById($this->request->user->getActiveOrganisation()); } }