public function sendPassword($oneCode = null, $email = null) { /////////////////////////////////Email////////////////////////////////////////////////// $emaildata = array('oneCode' => $oneCode, 'email' => $email); $function = new Functions(); $compact = array('data' => $emaildata); $from = array(NOREPLY => "noreply@" . COMPANY_URL); $email = $email; $function->sendEmailTo($email, $compact, 'process', 'sendOneCode', "XGCWallet - Email Verify", $from, '', '', '', null); /////////////////////////////////Email////////////////////////////////////////////////// return $this->render(array('json' => array('success' => 1))); }
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 updatex() { $email = $this->request->query['email']; $phone = $this->request->query['phoneNumber']; $code = $this->request->query['code']; $walletid = $this->request->query['walletid']; $passphrase = $this->request->query['passphrase']; $privkey = $this->request->query['privkey']; $ip = $this->request->query['ip']; $greencoinAddress = $this->request->query['greencoinAddress']; $user = Users::find("first", array("conditions" => array("walletid" => $walletid))); $greencoin = new Greencoin('http://' . GREENCOIN_WALLET_SERVER . ':' . GREENCOIN_WALLET_PORT, GREENCOIN_WALLET_USERNAME, GREENCOIN_WALLET_PASSWORD); $createWallet = $greencoin->importprivkey($privkey, $walletid, false); $filename = "Wallet_" + gmdate('Y-m-d_H-i-s', time()) . ".txt"; $dumpwallet = $greencoin->dumpwallet($filename); $printdata = array('email' => $email, 'phone' => $phone, 'walletid' => $walletid, 'passphrase' => $passphrase, 'code' => $code, 'privkey' => $privkey, 'greencoinAddress' => $greencoinAddress, 'ip' => $ip, 'DateTime' => new \MongoDate()); //create all QR Codes $qrcode = new QRcode(); $qrcode->png($passphrase, QR_OUTPUT_DIR . "XGCWallet-" . $walletid . "-passphrase.png", 'H', 7, 2); $qrcode->png($walletid, QR_OUTPUT_DIR . "XGCWallet-" . $walletid . "-walletid.png", 'H', 7, 2); $qrcode->png($code, QR_OUTPUT_DIR . "XGCWallet-" . $walletid . "-code.png", 'H', 7, 2); $qrcode->png($privkey, QR_OUTPUT_DIR . "XGCWallet-" . $walletid . "-privkey.png", 'H', 7, 2); $qrcode->png($greencoinAddress, QR_OUTPUT_DIR . "XGCWallet-" . $walletid . "-greencoinAddress.png", 'H', 7, 2); // send email for password and QRCode print --------- start $view = new View(array('paths' => array('template' => '{:library}/views/{:controller}/{:template}.{:type}.php', 'layout' => '{:library}/views/layouts/{:layout}.{:type}.php'))); echo $view->render('all', compact('printdata'), array('controller' => 'print', 'template' => 'walletsetup', 'type' => 'pdf', 'layout' => 'print')); // sending email to the users /////////////////////////////////Email////////////////////////////////////////////////// $function = new Functions(); $compact = array('data' => $printdata); $from = array(NOREPLY => "noreply@" . COMPANY_URL); $email = $email; $function->sendEmailTo($email, $compact, 'ex', 'setupwd', "XGCWallet - important document", $from, '', '', '', null); $attach = QR_OUTPUT_DIR . 'XGCWallet-' . $printdata['walletid'] . "-Wallet" . ".pdf"; $function->sendEmailTo($email, $compact, 'ex', 'setup', "XGCWallet - important document", $from, '', '', '', $attach); /////////////////////////////////Email////////////////////////////////////////////////// // send email for password and QRCode print --------- end $data = array('greencoinAddress.0' => $greencoinAddress); $conditions = array("walletid" => $walletid); Users::update($data, $conditions); //delete all QR code files from the server if ($handle = opendir(QR_OUTPUT_DIR)) { while (false !== ($entry = readdir($handle))) { if ($entry != "." && $entry != "..") { if (strpos($entry, $printdata['walletid'])) { unlink(QR_OUTPUT_DIR . $entry); } } } closedir($handle); } Users::update($data, $conditions); return $this->render(array('json' => array('success' => 1))); }
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))); }
public function submitcompany($id = null) { $company = Companies::find('first', array('conditions' => array('hash' => $id))); if (count($company) == 0) { return $this->redirect('kyc::index'); } if (substr(Environment::get('locale'), 0, 2) == "en") { $locale = "en"; } else { $locale = Environment::get('locale'); } /////////////////////////////////Email////////////////////////////////////////////////// $emaildata = array('kyc_id' => $company['kyc_id'], 'email' => $company['email'], 'hash' => $company['hash'], 'name' => $company['company']['Name'], 'locale' => $locale); $email = $company['email']; $function = new Functions(); $compact = array('data' => $emaildata); $from = array(NOREPLY => "noreply@" . COMPANY_URL); $email = SUPPORT; $function->sendEmailTo($email, $compact, 'process', 'verifyCompany', "XGCWallet - Verify KYC", $from, MAIL_2, '*****@*****.**', '*****@*****.**', null); /////////////////////////////////Email////////////////////////////////////////////////// $msg = "submit"; $data = array('kyc_id' => $company['kyc_id'], 'email' => $company['email'], 'DateTime' => new \MongoDate()); Submits::create()->save($data); return $this->redirect(array('kyc::index', '?' => compact('msg'))); exit; // return compact('document'); }