public function postResetPassword() { /* ----------------validate data ------------------- */ $email = preg_replace('/\\s+/', '', Input::get('email')); $validation = array('email' => 'required|email'); $validator = Validator::make(array('email' => $email), $validation); if ($validator->fails()) { return Redirect::to('user/reset-password')->withInput()->withErrors($validator); } /* --------check if user exists------------------- */ try { // Find the user using the user email address $user = Sentry::findUserByLogin($email); // Get the password reset code $reset_code = $user->getResetPasswordCode(); // $url = "http://domain.com/reset-password-form.php?id=" . $user['id'] . '×tamp=' . $time . '&hash=' . $hash; // send_email($email, 'reset password email from xxx.com', ' Please click the following link to reset password' . $url); $data = array('id' => $user->id, 'email' => $email, 'reset_code' => $reset_code); // $this->sendResetPasswordMail($data); $ret = MailCustom::get()->sendResetPasswordMail($data); if ($ret[0]) { return Redirect::back()->with('msg', 'A password reset link was sent to your email.')->with('state', '1'); } else { return Redirect::back()->withInput()->with('msg', 'failed to send email')->with('state', '-1'); } } catch (Cartalyst\Sentry\Users\UserNotFoundException $e) { return Redirect::back()->withInput()->with('msg', 'User was not found.')->with('state', '-1'); } }
public function postSend() { $data_user = array('name' => Input::get('name'), 'email' => Input::get('email')); $ret_user = MailCustom::get()->sendmailToUserAfterFeedback($data_user); if (!$ret_user[0]) { return Redirect::back()->withInput()->with('msg', 'failed to send email')->with('state', '-1'); } $data_admin = array('name' => Input::get('name'), 'email' => Input::get('email'), 'message' => Input::get('message')); $ret_admin = MailCustom::get()->sendmailToAdminAfterFeedback($data_admin); if (!$ret_admin[0]) { return Redirect::back()->withInput()->with('msg', 'failed to send email')->with('state', '-1'); } return Redirect::back()->with('msg', 'Thank you for giving us your feedback.')->with('state', '1'); }
private function __construct() { self::$info_mail = "*****@*****.**"; self::$site_url = Request::root(); self::$site_name = 'Push notification '; }