public function postChangePassword() { $input = Input::all(); $admin = Subscriber::findOrFail(Auth::user()->id)->first(); if (!Hash::check($input['current'], $admin->pword)) { $this->notifyError("Invalid Current Password."); return Redirect::back(); } $rules = Config::get('validations.admin_password', NULL); $v = Validator::make($input, $rules); if ($v->fails()) { return Redirect::back()->withInput()->withErrors($v); } $admin->pword = Hash::make($input['password']); $admin->clear_pword = $input['password']; if ($admin->save()) { $this->notifySuccess("Admin Password Successfully Updated."); } else { $this->notifyError("Failed to update admin password, please try again.."); } return Redirect::back(); }
public function postChangePassword() { $user_id = Input::get('user_id', 0); $current = Input::get('current', NULL); $user = Subscriber::findOrFail($user_id); if ($user->clear_pword != $current) { $this->notifyError("Incorrect current password."); return Redirect::back(); } $password = Input::get('password', NULL); $confirm = Input::get('confirm_password', NULL); if ($password != $confirm) { $this->notifyError("New password & confirm password do not match."); return Redirect::back(); } $user->clear_pword = $password; $user->pword = Hash::make($password); if ($user->save()) { $this->notifySuccess("Password Updated."); } else { $this->notifyError("Password Updation Failed."); } return Redirect::back(); }
public function postChangeServiceType() { try { // pr(Input::all()); $user_id = Input::get('user_id'); $user = Subscriber::findOrFail($user_id); $disconnect = new stdClass(); $disconnect->set = FALSE; DB::transaction(function () use($user, $disconnect) { $plan_type = Input::get('plan_type'); if ($user->plan_type != $plan_type) { $disconnect->set = TRUE; } $user->plan_type = $plan_type; if (!$user->save()) { throw new Exception('Failed to change service type.'); } if ($user->plan_type == ADVANCEPAID_PLAN) { $billing = BillingCycle::firstOrNew(['user_id' => $user->id]); $input = Input::all(); $input['expiration'] = date("Y-m-d H:i:s", strtotime($input['expiration'])); $billing->fill($input); if (!$billing->save()) { throw new Exception("Failed to save billing cycle details."); } // pr($billing->toArray()); } if ($user->plan_type == FREE_PLAN) { Subscriber::updateFreePlan($user->id); } }); if ($disconnect->set) { Subscriber::destroyAllSessions($user); } $this->notifySuccess("Service Type Updated."); } catch (Exception $e) { $this->notifyError($e->getMessage()); return Redirect::route('subscriber.profile', $user_id); } return Redirect::route('subscriber.profile', $user_id); }
public function getAssignRoute($user_id) { $user = Subscriber::findOrFail($user_id); return View::make("admin.subnet.assign-route")->with('profile', $user); }