Skip to content

Commit

Permalink
Fixed #288 -- Bug no módulo de autenticação
Browse files Browse the repository at this point in the history
  • Loading branch information
wilsonmoura committed May 26, 2023
1 parent 7f39dd2 commit 03fec0e
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 4 deletions.
7 changes: 6 additions & 1 deletion client/business.php
Expand Up @@ -5,7 +5,12 @@
require_once(dirname(__FILE__)."/classes/Authentication.php");

$data = Authentication::getUserData($_SESSION["userTK"]);


if ($data === false){
$_REQUEST["action"] = 'logout';
$_REQUEST["error"] = 'internal_server_error';
}

if ( !$data['agreement_date'] && 'logout' != $_REQUEST["action"] ) {
if ( $_REQUEST['origin'] ) {
$origin = base64_decode($_REQUEST['origin']);
Expand Down
6 changes: 4 additions & 2 deletions client/business/authentication.php
Expand Up @@ -139,10 +139,12 @@
}

/* Reload user data */
if(!empty($_SESSION["userTK"])){
if ( isset($_SESSION['userTK']) && !empty($_SESSION['userTK']) ) {
$result = Authentication::getUserData($_SESSION["userTK"]);

if ($result != false){
if ($result === false){
header('Location: '.RELATIVE_PATH.'/controller/logout/control/business');
} else {
$_SESSION["userFirstName"] = $result["userFirstName"];
$_SESSION["userLastName"] = $result["userLastName"];
$_SESSION["userMail"] = $result["userMail"];
Expand Down
3 changes: 3 additions & 0 deletions client/templates/default/authentication.tpl.php
Expand Up @@ -45,6 +45,9 @@
<?php if (($_GET['error'] && $_GET['error'] == 'access_denied') || $_GET['error_code'] ) : ?>
<span class="helper-text red-text error-text"><?php echo $trans->getTrans($_REQUEST["action"],'ACCESS_DENIED'); ?></span>
<?php endif; ?>
<?php if ($_GET['error'] && $_GET['error'] == 'internal_server_error') : ?>
<span class="helper-text red-text error-text"><?php echo $trans->getTrans($_REQUEST["action"],'INTERNAL_SERVER_ERROR'); ?></span>
<?php endif; ?>
<?php if ($response['values']['status'] === false) : ?>
<span class="helper-text red-text error-text"><?php echo $trans->getTrans($_REQUEST["action"],'INVALID_LOGIN'); ?></span>
<?php endif; ?>
Expand Down
1 change: 1 addition & 0 deletions client/translations/en/Translations.php
Expand Up @@ -74,6 +74,7 @@ public function translations(){
self::$trans["authentication"]["HELPLOGINMESSAGE"] = '';
self::$trans["authentication"]["KNOWMORE"] = 'Learn more';
self::$trans["authentication"]["ACCESS_DENIED"] = 'Access denied';
self::$trans["authentication"]["INTERNAL_SERVER_ERROR"] = 'internal server error';
self::$trans["authentication"]["OR"] = 'OR';
self::$trans["authentication"]["LOGIN_WITH"] = 'Sign in with';
self::$trans["authentication"]["LOGIN_MESSAGE"] = 'SIGN IN TO MyVHL';
Expand Down
1 change: 1 addition & 0 deletions client/translations/es/Translations.php
Expand Up @@ -74,6 +74,7 @@ public function translations(){
self::$trans["authentication"]["HELPLOGINMESSAGE"] = '';
self::$trans["authentication"]["KNOWMORE"] = 'sepa más';
self::$trans["authentication"]["ACCESS_DENIED"] = 'acceso denegado';
self::$trans["authentication"]["INTERNAL_SERVER_ERROR"] = 'error interno del servidor';
self::$trans["authentication"]["OR"] = 'O';
self::$trans["authentication"]["LOGIN_WITH"] = 'entrar con';
self::$trans["authentication"]["LOGIN_MESSAGE"] = 'INICIAR SESIÓN EN MiBVS';
Expand Down
1 change: 1 addition & 0 deletions client/translations/pt/Translations.php
Expand Up @@ -75,6 +75,7 @@ public function translations(){
self::$trans["authentication"]["HELPLOGINMESSAGE"] = '';
self::$trans["authentication"]["KNOWMORE"] = 'saiba mais';
self::$trans["authentication"]["ACCESS_DENIED"] = 'acesso negado';
self::$trans["authentication"]["INTERNAL_SERVER_ERROR"] = 'erro interno do servidor';
self::$trans["authentication"]["OR"] = 'OU';
self::$trans["authentication"]["LOGIN_WITH"] = 'entrar com';
self::$trans["authentication"]["LOGIN_MESSAGE"] = 'FAÇA O LOGIN NA MinhaBVS';
Expand Down
5 changes: 4 additions & 1 deletion client/view.php
Expand Up @@ -120,7 +120,10 @@
echo '</script>';
exit;
} else {
header("Location:".RELATIVE_PATH."/controller/".MAIN_PAGE);
if ( isset($_REQUEST['error']) && !empty($_REQUEST['error']) )
header("Location:".RELATIVE_PATH."/controller/".MAIN_PAGE."/?error=".$_REQUEST['error']);
else
header("Location:".RELATIVE_PATH."/controller/".MAIN_PAGE);
exit();
}
break;
Expand Down

0 comments on commit 03fec0e

Please sign in to comment.