public function sendReset() { $validator = Validator::make(Input::all(), array('email' => 'required|email')); // check for the required fields before doing anything else if ($validator->fails()) { return Redirect::back()->withInput()->withErrors($validator->messages()); } $email = Input::Get('email'); $candidate = Candidate::where('email', $email)->first(); if (!is_null($candidate)) { Candidate::sendReset($candidate->id); return Redirect::to('/')->withInfo('A password reset email has been sent to the email associated with your account.'); } else { return Redirect::to('/')->withInfo('No candidate with that email address.'); } return Redirect::to('/')->withInfo('There was an error.'); }