/**
  * Bootstrap the application services.
  *
  * @return void
  */
 public function boot()
 {
     User::created(function ($user) {
         $control = new PasswordController();
         $request = Request::capture();
         view()->composer('emails.password', function ($view) {
             $view->with(['new_user' => true]);
         });
         $result = $control->postEmail($request);
     });
 }
 public function apiResetPassword(Request $request)
 {
     $validator = Validator::make($request->all(), ['email' => 'required|email|exists:users,email']);
     if ($validator->fails()) {
         return response()->api(400, 'no', 'Email does not exist, or has incorrect format', '');
     }
     //comprovar si l'email es d'un usuari registrat
     $resetsPasswords = new PasswordController();
     $resetsPasswords->postEmail($request);
     //comprobar si el email se envia bien, y hacer que aparezca un mensaje tipo "El email se ha enviado", o de error en caso contrario
 }
Example #3
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $user = new User();
     $user->name = $request->name;
     $user->email = $request->email;
     if (is_array($request->recht)) {
         $user->groups = implode(",", $request->recht);
     } else {
         $user->groups = "";
     }
     $user->save();
     $auth = new Auth\PasswordController();
     $auth->postEmail($request);
     return redirect("user");
 }
 public function reset(Request $request)
 {
     $control = new PasswordController();
     view()->composer('emails.password', function ($view) {
         $view->with(['old_user' => true]);
     });
     $result = $control->postEmail($request);
     return redirect('user')->with('message', 'A mensagem para troca de senha foi enviada!');
 }