<commit_before><?php

namespace WebService\Controller;

use WebService\Form\UsuarioForm;
use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;
use Zend\Soap\Client;
use Zend\Soap\AutoDiscover;
use Zend\Soap\Server;
use Zend\Http\PhpEnvironment\Request;
use WebService\Model\Usuario;
use Zend\Authentication\Storage;
use Zend\Authentication\AuthenticationService;

class UsuarioController extends AbstractActionController
{
    public function __construct()
    {
    }
    
    public function indexAction()
    {   
        
        $auth = new AuthenticationService();
//        var_dump($auth->getIdentity());
        $auth->clearIdentity();
//        var_dump($auth->getIdentity());

//        session_reset();
        $form = new UsuarioForm();
        $form->get('submit')->setValue('Login');
        
        $request = $this->getRequest();
        if ($request->isPost()){
            $form->setData($request->getPost());
            if($form->isValid()){
                $login = $form->get("login")->getValue();
                $senha = $form->get("senha")->getValue();
            }
            
            ////////////////////////
            //Verifica no banco se há o login e senha e retorna o ID do usuário
//            $db = new \WebService\Database\Database();
//            $result = $db->login($login, $senha);
            ///////////////////////////
            
            $client = new Client('http://localizapet.esy.es/public/server.php?wsdl');
//            $client = new Client('http://localhost:8080/server.php?wsdl');
            $result = $client->login($login, $senha);
//            var_dump($result);
            
            if($result != NULL){
                //Seta o ID do usuário como parâmetro de Sessão
                $auth->getStorage()->write(['usuario_id' => $result]);
                
                var_dump($auth->getIdentity());
                <commit_msg>Form de login<commit_after><?php

namespace WebService\Controller;

use WebService\Form\UsuarioForm;
use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;
use Zend\Soap\Client;
use Zend\Soap\AutoDiscover;
use Zend\Soap\Server;
use Zend\Http\PhpEnvironment\Request;
use WebService\Model\Usuario;
use Zend\Authentication\Storage;
use Zend\Authentication\AuthenticationService;

class UsuarioController extends AbstractActionController
{
    public function __construct()
    {
    }
    
    public function indexAction()
    {   
        
        $auth = new AuthenticationService();
//        var_dump($auth->getIdentity());
        $auth->clearIdentity();
//        var_dump($auth->getIdentity());

//        session_reset();
        $form = new UsuarioForm();
        $form->get('submit')->setValue('Login');
        
        $request = $this->getRequest();
        if ($request->isPost()){
            $form->setData($request->getPost());
            if($form->isValid()){
                $login = $form->get("login")->getValue();
                $senha = $form->get("senha")->getValue();
            }
            
            ////////////////////////
            //Verifica no banco se há o login e senha e retorna o ID do usuário
//            $db = new \WebService\Database\Database();
//            $result = $db->login($login, $senha);
            ///////////////////////////
            
            $client = new Zend\Soap\Client('http://localizapet.esy.es/public/server.php?wsdl');
//            $client = new Client('http://localhost:8080/server.php?wsdl');
            $result = $client->login($login, $senha);
//            var_dump($result);
            
            if($result != NULL){
                //Seta o ID do usuário como parâmetro de Sessão
                $auth->getStorage()->write(['usuario_id' => $result]);
                
                var_dump($auth->getIdentity());
                
{'fraction_non_alphanumeric': 0.1678681771369722, 'fraction_numerical': 0.0020597322348094747, 'mean_word_length': 1.8713968957871396, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6075911', 'n_tokens_mistral': 1092, 'n_tokens_neox': 1061, 'n_words': 200}