/**
  * @param DispatcherContract $events
  */
 public function contextBackend(DispatcherContract $events)
 {
     $events->listen('view.user.edit.footer', function (User $user) {
         if (backend_auth()->id() == $user->id) {
             echo view('api::settings', compact('user'))->render();
         }
     });
 }
 public function handle()
 {
     $password = str_random(8);
     $user = $this->reflink->user;
     Bus::dispatch(new EmailSend('user_new_password', ['password' => $password, 'name' => $user->name, 'email' => $user->email]));
     $user->password = $password;
     $user->save();
     backend_auth()->login($user);
     $this->redirectUrl = backend_url();
     $this->message = trans(Password::PASSWORD_RESET);
 }
예제 #3
0
 /**
  * Verify the incoming request's user belongs to team.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure $next
  *
  * @return \Illuminate\Http\Response
  */
 public function handle($request, $next)
 {
     if (!backend_auth()->check()) {
         if ($user = \Auth::guard('api')->user()) {
             backend_auth()->setUser($user);
             $response = $next($request);
             $response->withCookie($this->repository->createCookie($user->token()));
             return $response;
         }
     }
     return $next($request);
 }
 public function registerMedia()
 {
     $errors = view()->shared('errors');
     $this->templateScripts = ['CURRENT_URL' => $this->request->url(), 'SITE_URL' => url()->current(), 'BASE_URL' => backend_url(), 'BACKEND_PATH' => backend_url_segment(), 'BACKEND_RESOURCES' => resources_url(), 'PUBLIC_URL' => url()->current(), 'LOCALE' => Lang::getLocale(), 'ROUTE' => !is_null($this->getRouter()) ? $this->getRouter()->currentRouteAction() : null, 'ROUTE_PATH' => $this->getRouterPath(), 'REQUEST_TYPE' => $this->requestType, 'USER_ID' => backend_auth()->id(), 'MESSAGE_ERRORS' => !is_null($errors) ? $errors->getBag('default') : [], 'MESSAGE_SUCCESS' => (array) $this->session->get('success', [])];
 }
예제 #5
0
 /**
  * @param \KodiCMS\Pages\Model\Page $page
  *
  * @return void
  */
 public function updating($page)
 {
     if (!is_null($user = backend_auth()->user())) {
         $page->updated_by_id = $user->id;
     }
 }
예제 #6
0
 /**
  * @param int|User $userId
  *
  * @return int
  */
 protected static function getUser($userId = null)
 {
     if ($userId === null) {
         return backend_auth()->id();
     }
     if ($userId instanceof User) {
         return $userId->id;
     }
     return $userId;
 }