Correction du merge
continuous-integration/drone/push Build is passing Details

interestingProfiles
johan 2 years ago
parent b02c9b3edd
commit c501609093

@ -11,3 +11,4 @@ RewriteRule ^createForm$ index.php?page=createForm [L]
RewriteRule ^addKeyword$ index.php?page=addKeyword [L]
RewriteRule "goToAdmin" index.php?page=goToAdmin [L]
RewriteRule ^goToAdminLogin$ index.php?page=goToAdminLogin [L]
RewriteRule ^login$ index.php?page=login [L]

@ -2,7 +2,7 @@
namespace API\script\Gateway;
use API\script\Config\Connection;
use Config\Connection;
use PDO;
/**

@ -2,7 +2,7 @@
namespace API\script\Gateway;
use API\script\Config\Connection;
use Config\Connection;
use PDO;
/**

@ -2,7 +2,7 @@
namespace API\script\Gateway;
use API\script\Config\Connection;
use Config\Connection;
use PDO;
/**

@ -2,7 +2,7 @@
namespace API\script\Gateway;
use API\script\Config\Connection;
use Config\Connection;
use PDO;
/**

@ -2,7 +2,7 @@
namespace API\script\Gateway;
use API\script\Config\Connection;
use Config\Connection;
use BusinessClass\BoxQuestion;
use BusinessClass\Question;
use BusinessClass\TextQuestion;

@ -2,7 +2,7 @@
namespace API\script\Gateway;
use API\script\Config\Connection;
use Config\Connection;
use PDO;
/**

@ -98,4 +98,10 @@ class Validate
global $responseMaxLength;
return (strlen($response) <= $responseMaxLength);
}
public static function username(string $username): bool
{
global $usernameMaxLength;
return (strlen($username) >= 3 && preg_match("#[a-zA-Z0-9]+#", $username) && strlen($username) <= $usernameMaxLength);
}
}

@ -3,6 +3,7 @@
namespace Controller;
use Model\ModelCandidate;
use Exception;
/**
* Permet de controller les réponses à fournir en fonction des actions passer dans l'URL
@ -38,4 +39,21 @@ class ControllerCandidate
{
(new ModelCandidate())->submitForm();
}
public function login() :void {
global $rep,$views;
try{
$model= new ModelCandidate();
$model->login();
if($_SESSION['role'] == "Admin") {
require_once($rep . $views['validLogin']);
}
else
{
require_once($rep . $views['adminLogin']);
}
} catch (Exception $e) {
$error = $e->getMessage();
require_once($rep . $views['adminLogin']);
}
}
}

@ -67,5 +67,6 @@ class FrontController {
$this->router->map('POST','/addKeyword',array($controller['Admin'],'addKeyword'),'addKeyword');
$this->router->map('GET','/goToAdmin',array($controller['Admin'],'goToAdmin'),'goToAdmin');
$this->router->map('GET','/goToAdminLogin',array($controller['Candidate'],'goToAdminLogin'),'goToLogin');
$this->router->map('POST','/login',array($controller['Candidate'],'login'),'login');
}
}

@ -0,0 +1,13 @@
<?php
namespace Exceptions;
use Exception;
class InexistantIdentifierException extends Exception
{
public function __construct()
{
parent::__construct("Identifiant inexistant");
}
}

@ -0,0 +1,12 @@
<?php
namespace Exceptions;
use Exception;
class InvalidIdentifierOrPasswordException extends Exception
{
public function __construct()
{
parent::__construct("Identifiant ou mot de passe invalide");
}
}

@ -0,0 +1,13 @@
<?php
namespace Exceptions;
use Exception;
class InvalidUsernameOrPasswordException extends Exception
{
public function __construct($message = "nom d'utilisateur ou mot de passe invalide", $code = 0, Exception $previous = null)
{
parent::__construct($message, $code, $previous);
}
}

@ -7,6 +7,7 @@ use API\script\Gateway\GatewayKeyword;
use API\script\Gateway\GatewayListResponseOfCandidate;
use API\script\Gateway\GatewayQuestion;
use BusinessClass\Form;
use PDOException;
/**
* Permet de développer les fonctions appelées par le controllerAdmin pour gérer

Loading…
Cancel
Save