/** * @Post("/auth/login") * @Middleware("guest") * * @return string */ public function authenticate() { $email = Input::get(Property::EMAIL); $password = Input::get(Property::PASSWORD); $active = 'ACTIVE'; $error = ""; /** @noinspection PhpUndefinedMethodInspection */ if (Access::attemptBy($email, $password, $active)) { return redirect()->intended('dashboard'); } else { /** @var User $user */ $user = $this->userRepository->findOneBy([Property::EMAIL => $email]); $error = $user === null || $user->getStatus() === $active ? trans('auth.failed') : trans('auth.not.active'); } return redirect('/')->with('error', $error); }
private function createMenuItem($item, $icon, Tag $t) { if (AccessHelper::exists($item) && AccessHelper::hasPermission($item, $this->getLoggedUser())) { /** @noinspection PhpMethodParametersCountMismatchInspection */ return $t->li($item === $this->getActive() ? a::c1ass('active') : '', [$t->a(a::href('/' . strtolower($item)), $t->i(a::c1ass('fa fa-' . strtolower($icon))), $t->span(trans('menu.' . strtolower($item))))]); } else { return ''; } }