public function getChangePasswordHint(ThreeStepUser $threeStepUser, ThreeStepAdmin $threeStepAdmin)
 {
     //        $three_step_user = $three_step_user
     //        	->where('role_id', 1)
     //        	->first();
     $data = $threeStepAdmin->getDataArrayChangePasswordHint($threeStepUser->getPasswordHint(Auth::user()->id), $this->arr_logged_in_user);
     return view('three_step_admin/change_password_hint')->with('data', $data);
 }
 public function postStepOne(Request $request, ThreeStep $threeStep, Client $client, ThreeStepUser $threeStepUser)
 {
     $validation_rules = $threeStep->getValidationRules();
     $this->validate($request, $validation_rules);
     $arr_request = $threeStep->getRequestArray($request);
     $objClient = $client->getObjClient($arr_request['client_id']);
     if ($objClient == null) {
         return view('three_step/bad_client_id');
     } else {
         $user_id = $objClient->user_id;
         $ts_bypass = $threeStepUser->getTSBypass($user_id);
         $bypass_warning = $threeStep->setBypassWarning($ts_bypass);
         $threeStepUser = $threeStepUser->where('user_id', $user_id)->first();
         if (!($threeStepUser == null)) {
             if (!Hash::check($arr_request['password'], $threeStepUser->password)) {
                 $errors = array('message' => 'Your credentials for this page could not be validated');
                 $data = $threeStep->getDataArrayGetStepOne($threeStepUser->hint, $arr_request['client_id'], $ts_bypass, $bypass_warning);
                 return view('three_step/step_one')->with('data', $data)->withErrors($errors);
             } else {
                 $three_step_id = $threeStep->generateThreeStepId($user_id);
                 $ts_test = $threeStepUser->getTSTest($user_id);
                 //   			check to see if there is already a row for this user
                 $objThreeStep = $threeStep->where('user_id', $user_id)->first();
                 if ($objThreeStep != null) {
                     $threeStep = $objThreeStep;
                 } else {
                     $threeStep->user_id = $user_id;
                 }
                 $threeStep->three_step_id = $three_step_id;
                 $threeStep->save();
                 if ($ts_bypass) {
                     $threeStep->deletePreviousLogins($threeStep->id, $threeStep->user_id);
                     //					$queries = DB::getQueryLog();
                     //					$last_query = end($queries);
                     //					echo "last query = $last_query<br>";
                     // next lines redirect to client start page
                     $redirect_url = $objClient->client_url;
                     $redirect_url .= "/three_step_remote/step_one/";
                     $redirect_url .= $three_step_id;
                     return redirect($redirect_url);
                 } else {
                     $threeStepUrl = $threeStep->prepareURL($threeStep->three_step_id, $arr_request['client_id']);
                     $recipient = $threeStepUser->email;
                     $data = $threeStep->getDataArrayEmail($arr_request['confidence_msg'], $threeStepUrl, $ts_test);
                     $mail_content = view('emails/three_step')->with('confidence_msg', $data['confidence_msg'])->with('three_step_link', $data['three_step_link'])->render();
                     //    $mail_content = "xyz";
                     //   					return view('three_step/step_one_success')
                     //  						->with('data', $data);
                     // this is the laravel mail
                     // commented out as no credentials for mail server are available
                     // see function in user.php moldel for more info
                     /*
                     	$user->sendMailResetPassword(
                     		$password_reset_url,
                     		$obj_user
                     	);
                     */
                     // echo "line 103 reached<br>";
                     $subject = "Three Step authorization";
                     //   echo "three step controller, line 247, email to = ".$objClient->user->email.'<br>';
                     if ($threeStep->boolSendMailThreeStep($data, $objClient->user)) {
                         return view('three_step/step_one_success')->with('data', $data);
                     } else {
                         return view('three_step/step_one_fail')->with('data', $data);
                     }
                 }
                 // end else, if no bypass
             }
             // end else, if hash check
         }
         // end if ! three step use == null
     }
     // end else, if objClient == null
 }