Created
March 8, 2020 01:06
-
-
Save ingliths/4cd95a5d39bcf8c58bf43ca38c2bb4ea to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class WebserviceController extends AppController | |
| { | |
| const URI= "http://:8080/axis2/services/WSSPM02?wsdl"; | |
| public function ler_do_webservice() { | |
| $SoapClient = new SoapClient (URI); | |
| $params = array ('args0' => '', ); | |
| $response = $SoapClient->ADNWSPM2 ($params); | |
| return $response; | |
| } | |
| public function ler_do_bancodedados(){ | |
| $usuario = ClassRegistry::init('Usuario'); | |
| $usuario->cpf(); | |
| $usuario->senha(); | |
| } | |
| } | |
| ?> | |
| <?php | |
| class UsuarioController extends WebserviceController { | |
| // var $components= array('Session'); | |
| // fazendo um teste | |
| public $sessionUsuario = 'usuario'; | |
| public $sessionFuncaoVinculo = 'funcao'; | |
| public $sessionLotacaoVinculo = 'lotacao'; | |
| public $sessionVinculo = 'vinculo'; | |
| public $sessionAgendaAtendimento = 'agendaAtendimento'; | |
| public $sessionAgendaAtendimentoDomicilio = 'agendaAtendimentoDomicilio'; | |
| public $sessionDependentes = 'dependente'; | |
| /* | |
| * Tipos de usuários; | |
| */ | |
| public $peritoCredenciado; | |
| public $peritoServidor; | |
| public $interno; | |
| public $servidor; | |
| public function __construct($request = null, $response = null) { | |
| parent::__construct($request, $response); | |
| $this->helpers[] = 'PForm'; | |
| $this->peritoCredenciado = USUARIO_PERITO_CREDENCIADO; | |
| $this->peritoServidor = USUARIO_PERITO_SERVIDOR; | |
| $this->interno = USUARIO_INTERNO; | |
| $this->servidor = USUARIO_SERVIDOR; | |
| } | |
| public function beforeFilter() { | |
| parent::beforeFilter(); | |
| $this->Auth->allow('recuperarSenha'); | |
| if(!empty($this->Session->read('usuario_session'))){ | |
| $this->Auth->allow('alterarSenhaLogin'); | |
| } | |
| $this->Auth->allow('loginSegundo'); | |
| } | |
| public function info(){ | |
| phpinfo(); | |
| } | |
| public function login() { | |
| $this->layout = 'public'; | |
| $this->Session->delete('usuario_session'); | |
| $isColaborador = false; | |
| if(isset($_GET['c'])){ | |
| $isColaborador = $_GET['c'] && true; | |
| }else if(isset($this->request->data['Usuario']) && isset($this->request->data['Usuario']['colaborador'])){ | |
| $isColaborador = $this->request->data['Usuario']['colaborador'] && true; | |
| } | |
| if($isColaborador){ | |
| $this->set('isColaborador', true); | |
| }else{ | |
| $this->set('isColaborador', false); | |
| } | |
| //pr($isColaborador);die; | |
| if ($this->Auth->user()){ | |
| $id = $this->Auth->user('id'); | |
| $currentFunction = $this->request->params['action']; //function corrente | |
| $currentController = $this->name; //Controller corrente | |
| $this->saveAuditLog($id,$currentController,'I',$currentFunction); | |
| $this->redirect(array( | |
| // 'plugin' => 'admin', | |
| 'plugin' => 'web', | |
| 'controller' => 'dashboard' | |
| )); | |
| } | |
| App::import('Vendor', 'recaptcha', array('file'=>'recaptcha' . DS . 'autoload.php') ); | |
| if ($this->request->is('post')) { | |
| if (WITH_CAPTCHA) { // && $this->Session->read('validaCaptchaCC') | |
| $privateKey = "6LeXziYTAAAAAAdbqc0hGOj4Bmpinq3tvUoZy0o9"; | |
| $recaptcha = new \ReCaptcha\ReCaptcha($privateKey); | |
| if (isset($this->request->data["g-recaptcha-response"])) { | |
| $resp = $recaptcha->verify($_POST['g-recaptcha-response'], $_SERVER['REMOTE_ADDR']); | |
| if (!$resp->isSuccess()) { | |
| $this->Session->setFlash(__('spm_erro_captcha'), 'flash_alert'); | |
| } else { | |
| $this->validarLogin(); | |
| } | |
| } | |
| } else { | |
| $this->validarLogin(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment