/** * 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())); }
public function testFindByCredentials() { $user = m::mock(); $user->email = '*****@*****.**'; $credentials = array('email' => '*****@*****.**'); Sentry::shouldReceive('findUserByCredentials')->with($credentials)->once()->andReturn($user); $this->assertEquals($user, $this->users->findByCredentials($credentials)); Sentry::shouldReceive('findUserByCredentials')->once()->andThrow('Cartalyst\\Sentry\\Users\\UserNotFoundException'); $this->assertFalse($this->users->findByCredentials(array('email' => ''))); $this->assertNotNull($this->users->getError()); }