/** * Funcionalidad cuando el usuario pierde la contrasena * * @param App\Http\Requests * * @return route */ public function forgotpassword(Request $request) { $password = PasswordGenerator::generate(); PassReset::create(['email' => $request->email, 'password' => $password['hashed']]); //MODIFICAR EMAIL EmailSender::sendResetPassInfro($password['plain'], $request->email); return redirect()->route('showLogin'); //MOSTRAR ALGUN AVISO? }
/** * Almacena el usuario en la base de datos. * La informacion es validad en el request. * La contrasena es generada y guardada en la table 'pasword_resets' * * @param App\Http\Requests\UsuarioRequest; * @return view users.index */ public function store(UsuarioRequest $request) { $user = User::create($request->all()); $user->username = Usernamegenerator::generate($request); $user->save(); $password = PasswordGenerator::generate(); PassReset::create(['email' => $user->email, 'password' => $password['hashed']]); EmailSender::sendUserInfo($password['plain'], $user); return redirect()->route('users.index'); }