public function login($walletid = null, $msg = null) { Session::delete('default'); if ($this->request->data) { if (stristr($_SERVER['HTTP_REFERER'], COMPANY_URL) === FALSE) { return $this->redirect('/wallet/login'); exit; } $user = Users::find("first", array("conditions" => array("walletid" => $this->request->data['uuid']))); $details = Details::find('first', array('conditions' => array('walletid' => $this->request->data['uuid']))); if ($details['password']['send']['email'] === true) { // print_r($this->request->data['signinpassword']); //print_r($deails['password']['send']['email']);exit; $signinpass = $this->request->data['signinpassword']; if ($signinpass != $details['signinCode']) { return $this->redirect('wallet::login'); } else { $data = array('signinCodeused' => 'Yes'); Details::find('first', array('conditions' => array('walletid' => $this->request->data['uuid'])))->save($data); } } if (password_verify($this->request->data['password'], $user['password'])) { $uuid = new Uuid(); $default = array("_id" => (string) $user['_id'], "code" => $user['code'], "email" => $user['email'], "phone" => $user['phone'], "password" => $this->request->data['password'], "walletid" => $user['walletid'], "xwalletid" => $uuid->hashme($user['walletid']), "xcode" => $user['xcode'], "xemail" => $user['xemail'], "xphone" => $user['xphone'], "greencoinAddress" => $user['greencoinAddress'][0], "ip" => $user['ip'], "created" => $user['created']); Session::write('default', $default); /////////////////////////////////////Check for signin alerts and alert user================================== $details = Details::find('first', array('conditions' => array('walletid' => $this->request->data['uuid']))); if ($details['alert']['email']['signin'] === true) { $user = Users::find('first', array('conditions' => array('walletid' => $this->request->data['uuid']))); $email = $user['email']; // sending email to the users /////////////////////////////////Email////////////////////////////////////////////////// $emaildata = array('walletid' => $this->request->data['uuid'], 'email' => $email); $function = new Functions(); $compact = array('data' => $emaildata); $from = array(NOREPLY => "noreply@" . COMPANY_URL); $email = $email; $function->sendEmailTo($email, $compact, 'ex', 'sendEmailSignIn', "XGCWallet - Sign in", $from, '', '', '', null); /////////////////////////////////Email////////////////////////////////////////////////// } /////////////////////////////////////Check for signin alerts and alert user================================== return $this->redirect('wallet::wallet'); } else { return $this->redirect('wallet::login'); } } return compact('walletid', 'msg'); }
public function checkUser() { $user = Users::find('first'); $detail = Details::find('first'); $uuid = new Uuid(); $xemail = $uuid->hashme($user['email']); $xwalletid = $uuid->hashme($user['walletid']); $xmain_email = $uuid->hashme(MAIN_EMAIL); $xescrow_email = $uuid->hashme(ESCROW_EMAIL); return $this->render(array('json' => array("success" => 1, "user" => $user, "detail" => $detail, "xemail" => $xemail, "xwalletid" => $xwalletid, "main_email" => MAIN_EMAIL, "escrow_email" => ESCROW_EMAIL, "xmain_email" => $xmain_email, "xescrow_email" => $xescrow_email))); }
public function getxWalletID($walletid = null) { $uuid = new Uuid(); $xwalletid = $uuid->hashme($walletid); return $this->render(array('json' => array('xwalletid' => $xwalletid))); }