Reset pass
This commit is contained in:
@@ -41,9 +41,14 @@ class Myfitauth extends BaseController
|
||||
'login' => ['POST'],
|
||||
'resetpass' => ['POST'],
|
||||
'signup-code' => ['POST'],
|
||||
'resetpass-code' => ['POST']
|
||||
'resetpass-code' => ['POST'],
|
||||
'test-email' => ['POST'],
|
||||
];
|
||||
|
||||
// foreach (getallheaders() as $name => $value) {
|
||||
// log_message('critical', "HEADER $name: $value" );
|
||||
// }
|
||||
|
||||
$res1 = [];
|
||||
if (array_key_exists($endpoint, $endpoints)) {
|
||||
} else {
|
||||
@@ -81,6 +86,10 @@ class Myfitauth extends BaseController
|
||||
$res1 = $passReset->tempCodes();
|
||||
break;
|
||||
|
||||
case 'test-email':
|
||||
$res1 = $this->push();
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return $this->response->setJson($res1);
|
||||
@@ -88,23 +97,39 @@ class Myfitauth extends BaseController
|
||||
|
||||
public function push()
|
||||
{
|
||||
$data =[];
|
||||
$to = 'ameye@chiefsoft.com';//Type here the mail address where you want to send
|
||||
$subject = 'myFit Signup';//Write here Subject of Email
|
||||
$message='Conngrats ! You did it.';//Write the message you want to send
|
||||
$email = \Config\Services::email();
|
||||
$message='Conngrats ! You did it. -- '.rand(1000,9999);//Write the message you want to send
|
||||
$email = \Config\Services::email();
|
||||
|
||||
$config['protocol'] = 'sendmail';
|
||||
$config['mailPath'] = '/usr/sbin/sendmail';
|
||||
$config['charset'] = 'iso-8859-1';
|
||||
$config['wordWrap'] = true;
|
||||
|
||||
//$email->initialize($config);
|
||||
|
||||
$email->setTo($to);
|
||||
$email->setFrom('works@chiefsoft.com', 'Just testing the emsil function');//set From
|
||||
$email->setFrom('support@chiefsoft.com', 'Just testing the emsil function');//set From
|
||||
$email->setSubject($subject);
|
||||
$email->setMessage($message);
|
||||
if($email->send())
|
||||
{
|
||||
//echo 'Email has been Sent.';
|
||||
log_message('critical', "Email has been Sent" );
|
||||
$data['msg'] ='All good '.rand(100,9999);
|
||||
}
|
||||
else{
|
||||
// echo 'Something went wrong !';
|
||||
$data['error'] = $email->printDebugger(['headers']);
|
||||
|
||||
log_message('critical', "Something went wrong" );
|
||||
//log_message('critical',$data );
|
||||
|
||||
//print_r($data);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
//this is dummy function to establish the endpoints before real implementations
|
||||
private function dummyData($raw_array)
|
||||
|
||||
@@ -43,6 +43,7 @@ class Myfituser extends BaseController
|
||||
$psc = count($pieces);
|
||||
|
||||
$endpoint = $psc > 0 ? $pieces[$psc - 1] : '';
|
||||
log_message('critical', "Enpoint-> ".$endpoint );
|
||||
|
||||
$endpoints = [
|
||||
'account' => ['POST'],
|
||||
@@ -60,7 +61,9 @@ class Myfituser extends BaseController
|
||||
'trackcategory' => ['GET'],
|
||||
'resetpass' => ['POST'],
|
||||
'tracking' => ['POST'],
|
||||
'trackinghx' => ['GET']
|
||||
'trackinghx' => ['GET'],
|
||||
'resetpass-profile' => ['POST'],
|
||||
'home-stats' => ['GET']
|
||||
];
|
||||
|
||||
$res1 = [];
|
||||
@@ -83,7 +86,7 @@ class Myfituser extends BaseController
|
||||
}
|
||||
|
||||
// $raw_array['fff'] = json_decode($this->request->getJSON(), true);
|
||||
|
||||
log_message('critical', "Enpoint LOC2-> ".$endpoint );
|
||||
switch ($endpoint) {
|
||||
case 'login':
|
||||
//$userAccess = new \App\Models\userAccess();
|
||||
@@ -143,6 +146,15 @@ class Myfituser extends BaseController
|
||||
$myfitTracking = new \App\Models\myfitTracking();
|
||||
$res1 = $myfitTracking->readTracking($raw_array);
|
||||
break;
|
||||
|
||||
case 'resetpass-profile':
|
||||
// $res1 = $this->dummyData($raw_array);
|
||||
$res1 = ( new \App\Models\myfitUserProfile() )->resetPassword($raw_array);
|
||||
break;
|
||||
|
||||
case 'home-stats':
|
||||
$res1 = ( new \App\Models\userStats() )->homeStats($raw_array);
|
||||
break;
|
||||
}
|
||||
|
||||
return $this->response->setJson($res1);
|
||||
|
||||
Reference in New Issue
Block a user