/** * Store newly created password reset to storage and send email to user. */ public function store() { $user = $this->users->findByCredentials(array('email' => Input::get('email'))); if ($user) { $this->reset->send($user); return Redirect::route('password-reset.create')->with('password_reset_sent', true); } return Redirect::route('password-reset.create')->withErrors(array('email' => $this->users->getError())); }
/** * Store a newly created user in storage. * * @return Response */ public function store() { if (!$this->validator->validate(Input::all())) { return Redirect::route('users.create')->withErrors($this->validator->getErrors())->withInput(); } $user = array('email' => Input::get('email'), 'password' => Input::get('password'), 'first_name' => Input::get('first_name'), 'last_name' => Input::get('last_name')); if ($user = $this->users->create($user)) { return Redirect::route('users.index'); } return Redirect::route('users.create')->withErrors(array('error' => $this->users->getError())); }
public function testDelete() { $mock = m::mock(); Sentry::shouldReceive('findUserById')->with(1)->once()->andReturn($mock); $mock->shouldReceive('delete')->once()->andReturn(true); $this->assertTrue($this->users->delete(1)); Sentry::shouldReceive('findUserById')->once()->andThrow('Cartalyst\\Sentry\\Users\\UserNotFoundException'); $this->assertFalse($this->users->delete(10)); $this->assertNotNull($this->users->getError()); }
/** * Attempt to activate user with code. * * @param int $id * @param string $code * @return \Illuminate\Http\RedirectResponse */ public function activate($id, $code) { if ($this->auth->check()) { return Redirect::route('profile.index'); } if ($this->users->activate($id, $code)) { return Redirect::route('session.create')->with('success_activation', true); } return Redirect::route('session.create')->with('error_activation', $this->users->getError()); }