Пример #1
0
 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');
 }
Пример #2
0
 public function checkemail()
 {
     $email = $this->request->query['email'];
     $uuid = new Uuid();
     $emails = Documents::find('first', array('conditions' => array('email' => $email)));
     if (count($emails) === 0) {
         $kyc_id = $uuid->v4v();
         $data = array('kyc_id' => $kyc_id, 'email' => $email, 'hash' => md5($email), 'IP' => $_SERVER['REMOTE_ADDR']);
         $Documents = Documents::create($data);
         $saved = $Documents->save();
     }
     $emails = Documents::find('first', array('conditions' => array('email' => $email)));
     /////////////////////////////////Email//////////////////////////////////////////////////
     $emaildata = array('kyc_id' => $kyc_id, 'email' => $email);
     $function = new Functions();
     $compact = array('data' => $emaildata);
     $from = array(NOREPLY => "noreply@" . COMPANY_URL);
     $email = $email;
     $function->sendEmailTo($email, $compact, 'process', 'sendKYC', "XGCWallet - Your KYC ID", $from, '', '', '', null);
     /////////////////////////////////Email//////////////////////////////////////////////////
     return $this->render(array('json' => array('success' => 1)));
 }
Пример #3
0
 public function checkCompanyemail()
 {
     $email = strtolower($this->request->query['email']);
     $uuid = new Uuid();
     $emails = Documents::find('first', array('conditions' => array('email' => $email)));
     if (count($emails) === 0) {
         $kyc_id = $uuid->v4v();
         $email_code = substr($kyc_id, 0, 4);
         $data = array('kyc_id' => $kyc_id, 'email_code' => $email_code, 'email' => $email, 'hash' => md5($email), 'IP' => $_SERVER['REMOTE_ADDR']);
         $Companies = Companies::create($data);
         $saved = $Companies->save();
     } else {
         $emails = Companies::find('first', array('conditions' => array('email' => $email)));
         $kyc_id = $emails['kyc_id'];
         if ($emails['Verify']['Score'] >= 80) {
             return $this->render(array('json' => array('success' => 0, 'reason' => 'Aleredy KYC complete')));
         }
     }
     /////////////////////////////////Email//////////////////////////////////////////////////
     $emaildata = array('kyc_id' => $kyc_id, 'email' => $email);
     $function = new Functions();
     $compact = array('data' => $emaildata);
     $from = array(NOREPLY => "noreply@" . COMPANY_URL);
     $email = $email;
     $function->sendEmailTo($email, $compact, 'process', 'sendKYCCompany', "KYCGlobal - Email Code", $from, '', '', '', null);
     /////////////////////////////////Email//////////////////////////////////////////////////
     return $this->render(array('json' => array('success' => 1)));
 }
Пример #4
0
 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)));
 }
Пример #5
0
 public function getxWalletID($walletid = null)
 {
     $uuid = new Uuid();
     $xwalletid = $uuid->hashme($walletid);
     return $this->render(array('json' => array('xwalletid' => $xwalletid)));
 }