/**
  * Updates the user existing password.
  *
  * @access  public
  * @return  response
  * @since   1.0.0
  */
 public function newPassword()
 {
     $data = Request::all();
     //Validation user's profile data
     $validator = Validator::make($data, Password::$arrPasswordConfirm);
     if ($validator->fails()) {
         $message = $validator->messages();
         foreach ($data as $key => $value) {
             $errorMessage = '';
             if ($message->has($key)) {
                 $errorMessage .= $message->first($key) . '\\n ';
             }
         }
         $arrResponse['status'] = Config::get('constants.API_ERROR');
         $arrResponse['msg'] = $errorMessage;
         return response()->json($arrResponse, 200);
     } else {
         //print_r($data['password']) ; die('..Ready Here');
         $arrData['password'] = $data['password'];
         $arrData['token'] = $data['token'];
         return response()->json(Password::updatePasswordDatabase($arrData), 200);
     }
 }
 public function addMember()
 {
     $password = str_random(6);
     $phone = Input::get('phone');
     $cityid = Input::get('city');
     $user_id = DB::table('users')->insertGetId(['full_name' => Input::get('full_name'), 'email' => Input::get('email'), 'password' => bcrypt($password), 'role_id' => 3, 'location_id' => Input::get('city'), 'phone_number' => $phone]);
     $data = array('full_name' => Input::get('full_name'), 'email' => Input::get('email'), 'phone_number' => Input::get('phone'));
     if ($user_id) {
         DB::table('user_attributes_varchar')->insert(['user_id' => $user_id, 'user_attribute_id' => 7, 'attribute_value' => '1' . str_pad($user_id, 6, '0', STR_PAD_LEFT)]);
         $createPasswordRequest = Password::creatRequestWebsitePassword($data);
         $createPasswordRequest['password'] = $password;
         Mail::send('site.pages.website_admin_registration', ['data' => $createPasswordRequest], function ($message) use($createPasswordRequest) {
             $message->from('*****@*****.**', 'WowTables by GourmetItUp');
             $message->to($createPasswordRequest['email'])->subject('You have been registered as a WowTables member!');
         });
         $city_name = Location::where(['Type' => 'City', 'id' => $cityid])->pluck('name');
         if (empty($city_name)) {
             $city_name = 'mumbai';
         }
         $city = ucfirst($city_name);
         $merge_vars = array('NAME' => isset($createPasswordRequest['userName']) ? $createPasswordRequest['userName'] : '', 'SIGNUPTP' => 'Email', 'BDATE' => '', 'GENDER' => '', 'MERGE11' => 0, 'MERGE17' => 'Admin added account', 'PHONE' => isset($phone) ? $phone : '', 'GROUPINGS' => array(array('id' => 9713, 'groups' => [$city])));
         $this->mailchimp->lists->subscribe($this->listId, ["email" => $createPasswordRequest['email']], $merge_vars, "html", false, true);
         $my_email = $createPasswordRequest['email'];
         $success_message = "Email " . $my_email . " has been registered as a member.";
         $data = array('user_id' => $user_id, 'success_message' => $success_message);
         echo json_encode($data);
     }
 }
Esempio n. 3
0
 public function newPassword()
 {
     //echo "sd"; //die;
     $data = $this->request->all();
     //echo "<pre>"; print_r($data); //die;
     //Validation user's profile data
     $validator = Validator::make($data, Password::$arrWebsitePasswordConfirm);
     if ($validator->fails()) {
         $message = $validator->messages();
         foreach ($data as $key => $value) {
             $errorMessage = '';
             if ($message->has($key)) {
                 $errorMessage .= $message->first($key) . '\\n ';
             }
         }
         $arrResponse['status'] = Config::get('constants.API_ERROR');
         $arrResponse['msg'] = $errorMessage;
         //return response()->json($arrResponse,200);
         if ($arrResponse['status'] == "FAIL") {
             return view('frontend.pages.invalid_request', $arrResponse);
         }
     } else {
         //print_r($data['password']) ; die('..Ready Here');
         $arrData['password'] = $data['password'];
         $arrData['token'] = $data['token'];
         //echo "<pre>"; print_r($arrData); die;
         $response = Password::updatePasswordDatabase($arrData);
         $cities = Location::where(['Type' => 'City', 'visible' => 1])->lists('name', 'id');
         $arrResponse['cities'] = $cities;
         $city_id = Input::get('city');
         $city_name = Location::where(['Type' => 'City', 'id' => $city_id])->pluck('name');
         if (empty($city_name)) {
             $city_name = 'mumbai';
         }
         $arrResponse['allow_guest'] = 'Yes';
         $arrResponse['current_city'] = strtolower($city_name);
         $arrResponse['current_city_id'] = $city_id;
         if ($response['status'] == "OK") {
             return view('frontend.pages.success_forgot_password', $arrResponse);
         } else {
             return view('frontend.pages.invalid_request', $arrResponse);
         }
     }
 }