/**
  * AdminUserController::updateUserActivationByAdmin()
  *
  * @return success_msg
  */
 public function updateUserActivationByAdmin($user_id, $action)
 {
     if (strtolower($action) == 'activate') {
         $user = User::where("id", $user_id)->where('activated', 0)->first();
         if ($user) {
             $activation_code = $user->getActivationCode();
             $userService = new UserAccountService();
             $userService->activateUser($user, $activation_code, $auto_login = false);
         }
         $success_msg = \Lang::get('webshopauthenticate::admin/manageMembers.memberlist_activated_suc_msg');
     } else {
         $user = User::where("id", $user_id)->first();
         $data_arr['activated'] = 0;
         User::where('id', $user_id)->update($data_arr);
         $success_msg = \Lang::get('webshopauthenticate::admin/manageMembers.memberlist_deactivated_suc_msg');
     }
     return $success_msg;
 }
 public function updateUserActivationByAdmin($user_id, $action)
 {
     if (strtolower($action) == 'activate') {
         $user = User::where("id", $user_id)->where('activated', 0)->first();
         if ($user) {
             $activation_code = $user->getActivationCode();
             $userService = new UserAccountService();
             $userService->activateUser($user, $activation_code, $auto_login = false);
         }
         $success_msg = trans('admin/manageMembers.memberlist_activated_suc_msg');
     } else {
         $user = User::where("id", $user_id)->first();
         $data_arr['activated'] = 0;
         User::where('id', $user_id)->update($data_arr);
         $success_msg = trans('admin/manageMembers.memberlist_deactivated_suc_msg');
     }
     // Add user log entry
     $data_arr['user_id'] = $user_id;
     $data_arr['added_by'] = getAuthUser()->id;
     $data_arr['date_added'] = date('Y-m-d H:i:s');
     $data_arr['log_message'] = $success_msg . " Added by: " . getAuthUser()->first_name . " On." . date('Y-m-d H:i:s');
     $userlog = new UserLog();
     $userlog->addNew($data_arr);
     return $success_msg;
 }
 public function postChangePassword()
 {
     $userService = new UserAccountService();
     //check if valid token from the password_reminders table, if not show error message
     $rules = array('password' => $userService->getValidatorRule('password') . '|Confirmed');
     $token = \Input::get('token');
     $v = \Validator::make(\Input::all(), $rules);
     if ($v->passes()) {
         $ret_msg = $userService->resetPassword(\Input::all());
         if ($ret_msg == '') {
             return \Redirect::to(\Config::get('webshopauthenticate::uri') . '/login')->with('success_message', \Lang::get('webshopauthenticate::auth/form.change_password.changepassword_success_message'));
         } else {
             return \Redirect::to(\Config::get('webshopauthenticate::uri') . '/change-password/' . $token)->withInput()->with('change_password_error', $ret_msg);
         }
     } else {
         return \Redirect::to(\Config::get('webshopauthenticate::uri') . '/change-password/' . $token)->withInput()->withErrors($v);
     }
 }