public function getx() { $uuid = new Uuid(); // Usage // Named-based UUID. $email = $this->request->query['email']; $phone = $this->request->query['phoneNumber']; $code = $this->request->query['code']; $walletid = $this->request->query['walletid']; $password = $this->request->query['password']; $ip = $this->request->query['ip']; $kyc = $this->request->query['kyc_id']; if ($email != null && $phone != null && $code != null && $walletid != null) { $xemail = $uuid->hashme($email); $xphone = $uuid->hashme($phone); $xcode = $uuid->hashme($code); $xwalletid = $uuid->hashme($walletid); $ga = new GoogleAuthenticator(); $secret = $ga->createSecret(64); $data = array('walletid' => $walletid, 'kyc' => $kyc, 'secret' => $secret, 'password.send.email' => false); $Details = Details::create($data); $saved = $Details->save(); $data = array('walletid' => $walletid, 'password' => password_hash($password, PASSWORD_BCRYPT), 'ip' => $ip, 'email' => $email, 'xemail' => $xemail, 'phone' => $phone, 'xphone' => $xphone, 'code' => $code, 'xcode' => $xcode); $Users = Users::create($data); $saved = $Users->save(); if ($saved == true) { $id = $Users->_id; } return $this->render(array('json' => array('success' => 1, 'record' => 0, 'email' => $email, 'phone' => $phone, 'code' => $code, 'walletid' => $walletid, 'password' => $password, 'xemail' => $xemail, 'xphone' => $xphone, 'xcode' => $xcode, 'xwalletid' => $xwalletid, 'id' => (string) $id, 'ip' => $ip))); } else { return $this->render(array('json' => array('success' => 0))); } }
public function register() { if (!$this->request->query['UserName']) { return $this->render(array('json' => array("Error" => "Username not specified"))); } if (!$this->request->query['FirstName']) { return $this->render(array('json' => array("Error" => "Firstname not specified"))); } if (!$this->request->query['LastName']) { return $this->render(array('json' => array("Error" => "Lastname not specified"))); } if (!$this->request->query['Email']) { return $this->render(array('json' => array("Error" => "Email not specified"))); } if (!$this->request->query['Password']) { return $this->render(array('json' => array("Error" => "Password not specified"))); } $uuid = new Uuid(); $ga = new GoogleAuthenticator(); $xemail = $uuid->hashme($this->request->query['Email']); $xwalletid = $uuid->hashme($this->request->query['Walletid']); $data = array('username' => $this->request->query['UserName'], 'firstname' => $this->request->query['FirstName'], 'lastname' => $this->request->query['LastName'], 'email' => $this->request->query['Email'], 'password' => password_hash($this->request->query['Password'], PASSWORD_BCRYPT), 'walletid' => $this->request->query['Walletid']); $Users = Users::create($data); $saved = $Users->save(); if ($saved == true) { $verification = sha1($Users->_id); $data = array('user_id' => (string) $Users->_id, 'username' => (string) $Users->username, 'email.verify' => $verification, 'email.verified' => "No", 'mobile.verified' => "No", 'mobile.number' => "", 'key' => $ga->createSecret(64), 'secret' => $ga->createSecret(64), 'walletid' => $this->request->query['Walletid']); Details::create()->save($data); } else { return $this->render(array('json' => array("success" => 0))); } $xmain_email = $uuid->hashme(MAIN_EMAIL); $xescrow_email = $uuid->hashme(ESCROW_EMAIL); return $this->render(array('json' => array("success" => 1, "xemail" => $xemail, "xwalletid" => $xwalletid, "recordid" => (string) $Users->_id, "main_email" => MAIN_EMAIL, "escrow_email" => ESCROW_EMAIL, "xmain_email" => $xmain_email, "xescrow_email" => $xescrow_email))); }
public function confirm($email = null, $verify = null) { if ($email == "" || $verify == "") { if ($this->request->data) { if ($this->request->data['email'] == "" || $this->request->data['verified'] == "") { return $this->redirect('Users::email'); } $email = $this->request->data['email']; $verify = $this->request->data['verified']; } else { return $this->redirect('Users::email'); } } $finduser = Users::first(array('conditions' => array('email' => $email))); $id = (string) $finduser['_id']; if ($id != null) { $data = array('email.verified' => 'Yes'); Details::create(); $details = Details::find('all', array('conditions' => array('user_id' => $id, 'email.verify' => $verify)))->save($data); if (empty($details) == 1) { return $this->redirect('Users::email'); } else { return $this->redirect('ex::dashboard'); } } else { return $this->redirect('Users::email'); } }
/** * CRIANDO UM NOVO USUÁRIO | CREATING NEW USER * Metodo para cadastramento de novo usuário, retorna mensagem para notificação ajax * @return Response * Ajax - usuario.js */ public function novoUser() { $senha_a = \Input::get('password'); $senha_b = \Input::get('rep_password'); $input = \Input::except('_token', 'img', 'rep_password', 'password', '_'); if ($input['name'] == '' || $input['email'] == '' || $senha_a == '' || $senha_b == '') { return 'camposvazio'; } else { if ($senha_a == $senha_b) { //Preparando pra salvar a senha no banco de dados $input['password'] = \Hash::make($senha_a); } else { return 'senhanaoconfere'; } //gerar uma senha //$senha = \App\Library\CoreHelpers::geraSenha(6); // Enviando email com a senha /* $data = array( 'site' => CNF_COMNAME, 'senha' => $senha, 'nome' => $input['name'], 'email' => $input['email'] ); \Mail::send('emails.nova-senha', $data, function ($m) use ($data) { $m ->to($data['email'], CNF_COMNAME) ->subject('Nova senha no sistema - '. CNF_COMNAME); }); */ //Data Atual $input['created_at'] = date('Y-m-d H:i:s'); // Criando um usuário $create = \App\Models\User::create($input); if ($create) { //Ultimo ID $ultimo_id = $create->id; // fazendo upload do avatar $avatar = ''; $file = \Input::file('img'); if (!empty($file)) { $upload = new \App\Library\UploadHelpers(); if ($upload->ImageUpload($file)) { $avatar = $upload->NomeArquivo(); // Criando o valor a ser enviado para o banco de dados com o nome e caminho do arquivo } } $details = \App\Models\Details::create(array('detail_perfil_id' => $ultimo_id, 'detail_avatar' => $avatar, 'created_at' => date('Y-m-d H:i:s'))); if ($details) { return 'sucesso'; } } } }