fix
This commit is contained in:
@@ -23,35 +23,19 @@ class Home extends WRB_Controller {
|
||||
|
||||
//Displays social login links
|
||||
public function index() {
|
||||
// Load Hybridauth's helper
|
||||
$this->load->helper('hybridauth');
|
||||
|
||||
//Instantiate Hybridauth's classes
|
||||
$hybrid = new Hybridauth($this->getHybridConfig());
|
||||
// Instantiate Hybridauth's classes
|
||||
$hybrid = new Hybridauth(get_hybridauth_config());
|
||||
|
||||
//Get enabled providers array
|
||||
$providers = $hybrid->getProviders();
|
||||
// Get login links
|
||||
$login_links = get_hybridauth_links($hybrid, $this->router);
|
||||
|
||||
// Pass login links to html template
|
||||
$data['login_links'] = $login_links;
|
||||
|
||||
$login_links = "";
|
||||
|
||||
$provider_icons = array(
|
||||
'Apple' => '/site3/assets/media/svg/brand-logos/apple-black.svg',
|
||||
'Facebook' => '/site3/assets/media/svg/brand-logos/facebook-4.svg',
|
||||
'Google' => '/site3/assets/media/svg/brand-logos/google-icon.svg'
|
||||
);
|
||||
|
||||
//List a link to login
|
||||
foreach ($providers as $provider)
|
||||
{
|
||||
$href = sprintf(base_url('%s/auth/%s/') , strtolower($this->router->fetch_class()) , $provider);
|
||||
$login_links .= '<a href="' . $href . '" class="btn btn-flex flex-center btn-light btn-lg w-100 mb-5">';
|
||||
if (array_key_exists($provider, $provider_icons)) {
|
||||
$login_links .= '<img alt="Logo" src="' . $provider_icons[$provider] . '" class="h-20px me-3">';
|
||||
}
|
||||
$login_links .= 'Continue with ' . $provider . '</a>';
|
||||
}
|
||||
|
||||
$data['login_links'] =''; // $login_links;
|
||||
|
||||
//$this->home1('');
|
||||
// Render html template
|
||||
$this->load->view('site3/external/view_home', $data);
|
||||
}
|
||||
|
||||
@@ -59,119 +43,5 @@ class Home extends WRB_Controller {
|
||||
|
||||
$this->home2('home2/about');
|
||||
}
|
||||
|
||||
//Processes social login
|
||||
function auth($provider = NULL)
|
||||
{
|
||||
$service = NULL;
|
||||
|
||||
try
|
||||
{
|
||||
//Instantiate Hybridauth's classes
|
||||
$hybrid = new Hybridauth($this->getHybridConfig());
|
||||
|
||||
//Check if given provider is enabled
|
||||
if ((isset($provider)) && in_array($provider, $hybrid->getProviders()))
|
||||
{
|
||||
$this->session->set_userdata('provider', $provider);
|
||||
}
|
||||
|
||||
//Update variable with the valid provider
|
||||
$provider = $this->session->userdata('provider');
|
||||
|
||||
if ($provider)
|
||||
{
|
||||
$service = $hybrid->authenticate($provider);
|
||||
if ($service->isConnected())
|
||||
{
|
||||
//Get user profile
|
||||
$profile = $service->getUserProfile();
|
||||
|
||||
//Get user contacts
|
||||
$contacts = $service->getUserContacts();
|
||||
|
||||
/*
|
||||
Disconnect the service else HA would reuse stored session data
|
||||
rather making a fresh request in case the user has denied permissions
|
||||
in the previous authorization request
|
||||
*/
|
||||
$service->disconnect();
|
||||
|
||||
$this->session->unset_userdata('provider');
|
||||
|
||||
//Display the profile data
|
||||
echo 'Name: ' . $profile->displayName;
|
||||
print_r($profile);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->session->set_flashdata('showmsg', array('msg' => 'Sorry! We couldn\'t authenticate your identity.'));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
if (isset($service) && $service->isConnected())
|
||||
$service->disconnect();
|
||||
|
||||
$error = 'Sorry! We couldn\'t authenticate you.';
|
||||
$this->session->set_flashdata('showmsg', array('msg' => $error));
|
||||
$error .= '\nError Code: ' . $e->getCode();
|
||||
$error .= '\nError Message: ' . $e->getMessage();
|
||||
|
||||
log_message('error', $error);
|
||||
}
|
||||
|
||||
//redirect();
|
||||
}
|
||||
|
||||
//Hybridauth configuration
|
||||
private function getHybridConfig()
|
||||
{
|
||||
$config = array(
|
||||
|
||||
'callback' => site_url('social/auth/') ,
|
||||
|
||||
'providers' => array(
|
||||
'Google' => array(
|
||||
'enabled' => true,
|
||||
'keys' => array(
|
||||
'id' => 'YOUR_CLIENT_ID',
|
||||
'secret' => 'YOUR_CLIENT_SECRET'
|
||||
) ,
|
||||
'scope' => 'https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile'
|
||||
) ,
|
||||
|
||||
'Facebook' => array(
|
||||
'enabled' => true,
|
||||
'keys' => array(
|
||||
'id' => (ENVIRONMENT == 'development') ? '390204307987009' : '390204307987009',
|
||||
'secret' => (ENVIRONMENT == 'development') ? '19f778e312f2ab96d147bacb612910c2' : '19f778e312f2ab96d147bacb612910c2'
|
||||
) ,
|
||||
'scope' => 'email, public_profile'
|
||||
) ,
|
||||
|
||||
'Apple' => array(
|
||||
"enabled" => true,
|
||||
"keys" => [
|
||||
"id" => "Your Apple ID",
|
||||
"team_id" => "Your Apple team id",
|
||||
"key_id" => "Your Apple key id",
|
||||
"key_content" => "Your Apple key (content including BEGIN and END lines)",
|
||||
"key_file" => "Full path to your Apple key file (alternative to key_content)"
|
||||
],
|
||||
"scope" => "name email",
|
||||
"verifyTokenSignature" => true
|
||||
)
|
||||
) ,
|
||||
|
||||
'hybrid_debug' => array(
|
||||
'debug_mode' => 'info', /* none, debug, info, error */
|
||||
'debug_file' => APPPATH . '/logs/log-' . date('Y-m-d') . '.php'
|
||||
)
|
||||
);
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -33,6 +33,66 @@ class Jobs extends Users_Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public function startcreate(){
|
||||
$data = $this->getSessionArray();
|
||||
$this->load->model('dash_model');
|
||||
$out = $this->dash_model->getDashData($data);
|
||||
$data['active_task'] = $out['active_task'];
|
||||
$data['active_pass_due'] = $out['active_pass_due'];
|
||||
$data['current_balance'] = $out['current_balance'];
|
||||
$data['new_message'] = $out['new_message'];
|
||||
$data['template_data'] = $this->jobsTemplates();
|
||||
$this->renderSecurePage('jobs/view_startcreate', $data);
|
||||
}
|
||||
|
||||
private function jobsTemplates(){
|
||||
|
||||
return [
|
||||
[
|
||||
'ID'=>'FACEBOOKSHARE',
|
||||
'name'=>'Share my article on your facebook page',
|
||||
'description'=>'We’ve been focused on making a the from also not been eye',
|
||||
'delivery'=>'',
|
||||
'img'=>'/site3/assets/media/jobs/share-stories.jpg',
|
||||
'timeline_days'=>'7'
|
||||
],
|
||||
[
|
||||
'ID'=>'TESTMYAPP',
|
||||
'name'=>'Test my App and give feedback',
|
||||
'description'=>'We’ve been focused on making a the from also not been eye',
|
||||
'delivery'=>'',
|
||||
'img'=>'/site3/assets/media/jobs/test-app.jpg',
|
||||
'timeline_days'=>'7'
|
||||
],
|
||||
[
|
||||
'ID'=>'REVIEWFEEDBACK',
|
||||
'name'=>'Review My Blog Story with feedback',
|
||||
'description'=>'We’ve been focused on making a the from also not been eye',
|
||||
'delivery'=>'',
|
||||
'img'=>'/site3/assets/media/jobs/review-stories.jpg',
|
||||
'timeline_days'=>'7'
|
||||
],
|
||||
[
|
||||
'ID'=>'PROPOSEBLOG',
|
||||
'name'=>'Propose new articles tiltles for my blog',
|
||||
'description'=>'We’ve been focused on making a the from also not been eye',
|
||||
'delivery'=>'',
|
||||
'img'=>'/site3/assets/media/jobs/propose-new.jpg',
|
||||
'timeline_days'=>'7'
|
||||
],
|
||||
[
|
||||
'ID'=>'WEBSITEREVIEW',
|
||||
'name'=>'Visit and review my Website',
|
||||
'description'=>'We’ve been focused on making a the from also not been eye',
|
||||
'delivery'=>'',
|
||||
'img'=>'/site3/assets/media/jobs/review-site.jpg',
|
||||
'timeline_days'=>'7'
|
||||
],
|
||||
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
public function active() {
|
||||
|
||||
$data['username'] = $_SESSION['username']; // = $this->input->post('username');
|
||||
@@ -902,12 +962,17 @@ echo $this->getMarketInterestMessage( $data['offer_code'], $out['client_id'] )
|
||||
$data['current_balance'] = $out['current_balance'];
|
||||
$data['new_message'] = $out['new_message'];
|
||||
|
||||
$this->load->view('users/view_header_user', $data);
|
||||
$this->load->view('jobs/view_create', $data);
|
||||
$this->load->view('users/view_footer_user', $data);
|
||||
// $this->load->view('users/view_header_user', $data);
|
||||
// $this->load->view('jobs/view_create', $data);
|
||||
// $this->load->view('users/view_footer_user', $data);
|
||||
|
||||
$this->renderSecurePage('jobs/view_create', $data);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function processjob() {
|
||||
$jobID = $this->input->post('jobID');
|
||||
if ($jobID > 0) {
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
<?php
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
//Include Hybridauth autoloader
|
||||
require APPPATH . '/third_party/hybridauth/autoload.php';
|
||||
|
||||
//Import Hybridauth's namespace
|
||||
use Hybridauth\Hybridauth;
|
||||
|
||||
class Login extends WRB_Controller {
|
||||
|
||||
public function __construct() {
|
||||
@@ -48,7 +56,7 @@ class Login extends WRB_Controller {
|
||||
$out = array();
|
||||
$res = $this->backend_model->wrenchboard_api($data, $out);
|
||||
$is_live = $this->backend_model->cfgReadChar("system.live");
|
||||
// print_r($out);
|
||||
// print_r($out);
|
||||
if ($res == PHP_LOGIN_OK) {
|
||||
$this->load->model('account_model');
|
||||
$ret = $this->account_model->username_data($data);
|
||||
@@ -90,30 +98,14 @@ class Login extends WRB_Controller {
|
||||
} else {
|
||||
echo validation_errors();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if ($this->lib_login->is_authenticated()) {
|
||||
$fb_data = $this->lib_login->getData($this->lib_login->get_access_token());
|
||||
if (isset($fb_data['me'])) {
|
||||
$user = $fb_data['me'];
|
||||
$proceed = false;
|
||||
//$data["login_message"] = $user["id"]."/".$user["name"]."/".$user["email"]."<a href='".$this->lib_login->getLogoutUrl()."'>Logout</a>";
|
||||
$q = "SELECT * FROM members WHERE lower(email)=lower('" . $user["name"] . "') AND password IS NULL AND fb_id='" . $user["id"] . "'";
|
||||
$query = $this->db->query($q);
|
||||
if (count($query->result_array)) {
|
||||
// Account exists
|
||||
$proceed = true;
|
||||
} else {
|
||||
$q = "SELECT * FROM members WHERE lower(email)=lower('" . $user["name"] . "')";
|
||||
$query = $this->db->query($q);
|
||||
if (count($query->result_array)) {
|
||||
$data["login_message"] = "The e-mail " . $user["email"] . " is already registered. You should login with your username and password.";
|
||||
} else {
|
||||
// Create account
|
||||
$proceed = true;
|
||||
}
|
||||
}
|
||||
|
||||
list($proceed, $data) = $this->checkUserExists($user, $data);
|
||||
|
||||
if ($proceed) {
|
||||
$name = (string) $user["name"];
|
||||
if (trim($name) == "")
|
||||
@@ -169,12 +161,26 @@ class Login extends WRB_Controller {
|
||||
//----- long out $this->load->view('templates/header_boxed', $data);
|
||||
//$this->load->view('users/view_login', $data);
|
||||
//$this->load->view('users/view_external_footer');
|
||||
|
||||
// Load Hybridauth's helper
|
||||
$this->load->helper('hybridauth');
|
||||
|
||||
// Instantiate Hybridauth's classes
|
||||
$hybrid = new Hybridauth(get_hybridauth_config());
|
||||
|
||||
// Get login links
|
||||
$login_links = get_hybridauth_links($hybrid, $this->router);
|
||||
|
||||
// Pass login links to html template
|
||||
$data['login_links'] = $login_links;
|
||||
|
||||
// Render html template
|
||||
$this->load->view('site3/external/view_home',$data);
|
||||
}
|
||||
|
||||
//<a href="/password_recovery">Forgot Password ?</a>
|
||||
//<a href="/password_recovery">Forgot Password ?</a>
|
||||
|
||||
public function refreshAccountDetail($member_id) {
|
||||
public function refreshAccountDetail($member_id) {
|
||||
$this->load->model('account_model');
|
||||
$qr = $this->account_model->loadAccountData($member_id);
|
||||
$this->load->model('account_model');
|
||||
@@ -184,13 +190,153 @@ class Login extends WRB_Controller {
|
||||
$_SESSION['active_task'] = $this->account_model->loadActiveTaskCount($member_id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private function checkUserExists($user, $data)
|
||||
{
|
||||
$proceed = false;
|
||||
//$data["login_message"] = $user["id"]."/".$user["name"]."/".$user["email"]."<a href='".$this->lib_login->getLogoutUrl()."'>Logout</a>";
|
||||
$q = "SELECT * FROM members WHERE lower(email)=lower('" . $user["name"] . "') AND password IS NULL AND fb_id='" . $user["id"] . "'";
|
||||
$query = $this->db->query($q);
|
||||
if (count($query->result_array)) {
|
||||
// Account exists
|
||||
$proceed = true;
|
||||
} else {
|
||||
$q = "SELECT * FROM members WHERE lower(email)=lower('" . $user["name"] . "')";
|
||||
$query = $this->db->query($q);
|
||||
if (count($query->result_array)) {
|
||||
$data["login_message"] = "The e-mail " . $user["email"] . " is already registered. You should login with your username and password.";
|
||||
} else {
|
||||
// Create account
|
||||
$proceed = true;
|
||||
}
|
||||
}
|
||||
return array($proceed, $data);
|
||||
}
|
||||
|
||||
public function logout() {
|
||||
$this->lib_login->destroy_session();
|
||||
redirect('login', redirect);
|
||||
}
|
||||
|
||||
//Processes social login
|
||||
function auth($provider = NULL)
|
||||
{
|
||||
// Load Hybridauth's helper
|
||||
$this->load->helper('hybridauth');
|
||||
|
||||
$service = NULL;
|
||||
|
||||
try
|
||||
{
|
||||
//Instantiate Hybridauth's classes
|
||||
$hybrid = new Hybridauth(get_hybridauth_config());
|
||||
|
||||
//Check if given provider is enabled
|
||||
if ((isset($provider)) && in_array($provider, $hybrid->getProviders()))
|
||||
{
|
||||
$this->session->set_userdata('provider', $provider);
|
||||
}
|
||||
|
||||
//Update variable with the valid provider
|
||||
$provider = $this->session->userdata('provider');
|
||||
|
||||
if ($provider)
|
||||
{
|
||||
$service = $hybrid->authenticate($provider);
|
||||
if ($service->isConnected())
|
||||
{
|
||||
//Get user profile
|
||||
$profile = $service->getUserProfile();
|
||||
|
||||
//Get user contacts
|
||||
$contacts = $service->getUserContacts();
|
||||
|
||||
/*
|
||||
Disconnect the service else HA would reuse stored session data
|
||||
rather making a fresh request in case the user has denied permissions
|
||||
in the previous authorization request
|
||||
*/
|
||||
$service->disconnect();
|
||||
|
||||
$this->session->unset_userdata('provider');
|
||||
|
||||
//Display the profile data
|
||||
echo 'Name: ' . $profile->displayName;
|
||||
print_r($profile);
|
||||
exit();
|
||||
|
||||
/*
|
||||
$user = array(
|
||||
'id' => '',
|
||||
'name' => '',
|
||||
'email' => ''
|
||||
);
|
||||
list($proceed, $data) = $this->checkUserExists($user, $data);
|
||||
|
||||
// TODO
|
||||
if ($proceed) {
|
||||
$name = (string) $user["name"];
|
||||
if (trim($name) == "")
|
||||
$name = strtok($user["email"], "@");
|
||||
$data['fb_id'] = $user["id"];
|
||||
$data['firstname'] = strtok($name, " ");
|
||||
$data['lastname'] = strtok(" ");
|
||||
$data['email'] = $user["email"];
|
||||
$data['sessionid'] = rand(10000, 99999) . "A" . rand(10000, 99999);
|
||||
$data['action'] = WRENCHBOARD_FACEBOOK_LOGIN;
|
||||
$this->load->model('backend_model');
|
||||
$out = array();
|
||||
$res = $this->backend_model->wrenchboard_api($data, $out);
|
||||
if ($res == PHP_LOGIN_OK) {
|
||||
$this->load->model('account_model');
|
||||
$ret = $this->account_model->username_data($out);
|
||||
if ($res !== false) {
|
||||
$data["login_message"] = "Welcome...";
|
||||
// yes person has an account
|
||||
$_SESSION['session_id'] = $out["session"];
|
||||
$_SESSION['username'] = $ret->username;
|
||||
$_SESSION['name'] = $ret->username;
|
||||
$_SESSION['firstname'] = $ret->firstname;
|
||||
$_SESSION['lastname'] = $ret->lastname;
|
||||
$_SESSION['email'] = $ret->email;
|
||||
$_SESSION['member_id'] = $ret->id;
|
||||
$_SESSION['log_count'] = 0;
|
||||
$_SESSION['mesaage_count'] = 0;
|
||||
$this->findOffers($_SESSION['email']);
|
||||
$_SESSION['message_snapshot'] = $this->myMessagesSnapshot();
|
||||
|
||||
$this->logUser('Account login');
|
||||
$this->refreshAccountDetail($_SESSION['member_id']);
|
||||
$this->getSessionArray();
|
||||
|
||||
$this->excudedEmails();
|
||||
|
||||
redirect('dash');
|
||||
}
|
||||
}
|
||||
}
|
||||
// */
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->session->set_flashdata('showmsg', array('msg' => 'Sorry! We couldn\'t authenticate your identity.'));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
if (isset($service) && $service->isConnected())
|
||||
$service->disconnect();
|
||||
|
||||
$error = 'Sorry! We couldn\'t authenticate you.';
|
||||
$this->session->set_flashdata('showmsg', array('msg' => $error));
|
||||
$error .= '\nError Code: ' . $e->getCode();
|
||||
$error .= '\nError Message: ' . $e->getMessage();
|
||||
|
||||
log_message('error', $error);
|
||||
}
|
||||
|
||||
//redirect();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,12 @@
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
//Include Hybridauth autoloader
|
||||
require APPPATH . '/third_party/hybridauth/autoload.php';
|
||||
|
||||
//Import Hybridauth's namespace
|
||||
use Hybridauth\Hybridauth;
|
||||
|
||||
class Site extends WRB_Controller {
|
||||
|
||||
public function index() {
|
||||
@@ -11,9 +17,21 @@ class Site extends WRB_Controller {
|
||||
$this->load->view('users/view_external_footer');
|
||||
* */
|
||||
|
||||
// $this->home1();
|
||||
$this->load->view('site3/external/view_home');
|
||||
///home/oameye/wrenchboard/www/application/views/site3/external
|
||||
// Load Hybridauth's helper
|
||||
$this->load->helper('hybridauth');
|
||||
|
||||
// Instantiate Hybridauth's classes
|
||||
$hybrid = new Hybridauth(get_hybridauth_config());
|
||||
|
||||
// Get login links
|
||||
$login_links = get_hybridauth_links($hybrid, $this->router);
|
||||
|
||||
// Pass login links to html template
|
||||
$data['login_links'] = $login_links;
|
||||
|
||||
// Render html template
|
||||
$this->load->view('site3/external/view_home');
|
||||
///home/oameye/wrenchboard/www/application/views/site3/external
|
||||
}
|
||||
|
||||
public function registration() {
|
||||
|
||||
Reference in New Issue
Block a user