/**
  * Send a reset link to the given user.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function postEmail(Request $request)
 {
     $this->validate($request, ['email' => 'required|email']);
     $email = $request->input('email');
     $user = $this->user->pushCriteria(new UserWhereEmailEquals($email))->all()->first();
     Audit::log(null, trans('passwords.audit-log.category'), trans('passwords.audit-log.msg-request-reset', ['email' => $email]));
     if (is_null($user)) {
         Flash::error(trans(Password::INVALID_USER));
         return redirect()->back();
     } elseif ($user->auth_type !== 'internal') {
         Flash::error(trans('passwords.auth_type'));
         return redirect()->back();
     } else {
         $response = Password::sendResetLink($request->only('email'), function (Message $message) {
             $message->subject($this->getEmailSubject());
         });
         switch ($response) {
             case Password::RESET_LINK_SENT:
                 Flash::success(trans($response));
                 return redirect()->back()->with('status', trans($response));
             case Password::INVALID_USER:
                 Flash::error(trans($response));
                 return redirect()->back()->withErrors(['email' => trans($response)]);
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * Display a listing of the User.
  *
  * @param Request $request
  * @return Response
  */
 public function index(Request $request)
 {
     $this->authorize('users.view');
     $this->userRepository->pushCriteria(new RequestCriteria($request));
     $users = $this->userRepository->paginate(50);
     return view('users.index')->with('users', $users);
 }
 /**
  * @return \Illuminate\View\View
  */
 public function index()
 {
     $page_title = trans('admin/users/general.page.index.title');
     // "Admin | Users";
     $page_description = trans('admin/users/general.page.index.description');
     // "List of users";
     $users = $this->user->pushCriteria(new UsersWithRoles())->pushCriteria(new UsersByUsernamesAscending())->paginate(10);
     return view('admin.users.index', compact('users', 'page_title', 'page_description'));
 }
 public function searchByName(Request $request)
 {
     $return_arr = null;
     $query = $request->input('query');
     $users = $this->user->pushCriteria(new UsersWhereFirstNameOrLastNameOrUsernameLike($query))->all();
     foreach ($users as $user) {
         $id = $user->id;
         $first_name = $user->first_name;
         $last_name = $user->last_name;
         $username = $user->username;
         $entry_arr = ['id' => $id, 'text' => "{$first_name} {$last_name} ({$username})"];
         $return_arr[] = $entry_arr;
     }
     return $return_arr;
 }
 /**
  * @return \Illuminate\View\View
  */
 public function index()
 {
     $users = $this->user->pushCriteria(new UsersWithRoles())->paginate(10);
     return view('users.index', compact('users'));
 }