Bonjour,
Je voudrais créer un formulaire de connexion dans mon application. Ce formulaire sera destiné au candidat qui pourra s'identifier(email et mot de passe) afin d'entrer dans son compte. j'ai donc essayé de tricher le fonctionnement du module 'authentification' de MkFramework. Voici d'abord le formulaire dans le fichier 'comptes/view/connexion.php' :
Puis dans mon module 'comptes' j'ai ceci:
Code html : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 <center><p>Connectez-vous</p> <fieldset style="width:60%"> <legend> Connexion </legend> <form method="POST" action="" name="form_connexion" > <center style="margin-top:5px;"><table > <tr> <td><input type="text" name="email" SIZE="25" placeholder="E-mail"/></td> </tr> <tr> <td><input type="password" name="mdp" SIZE="25" placeholder="mot de passe" /></td> </tr> <tr> <td><center><input type="submit" id="submit" name="submit_connexion" value="Se connecter" /></center></td> </tr> </table></center> </fieldset> </form> </center>
Selon moi ça devrait aller comme sur des roulettes!Mais non
Code php : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40 public function _connexion(){ //_root::getAuth()->enable(); $sMessage=$this->checkLoginPass(); $oView=new _view('comptes::connexion'); $oView->sError=$sMessage; $this->oLayout->add('main',$oView); $this->oLayout->title="bebe"; } private function checkLoginPass(){ //si le formulaire n'est pas envoye on s'arrete la if(!_root::getRequest()->isPost() ){ return null; } $sLogin=_root::getParam('email'); $sPassword=_root::getParam('mdp'); /*if(strlen($sPassword) > $this->maxPasswordLength){ return 'Mot de passe trop long'; }*/ //on stoque les mots de passe hashe dans la classe model_utilisateurs //$sHashPassword=model_utilisateurs::getInstance()->hashPassword($sPassword); $tAccount=model_candidats::getInstance()->getListAccount(); //on va verifier que l'on trouve dans le tableau retourne par notre model //l'entree $tAccount[ login ][ password ] if(!_root::getAuth()->checkLoginPass($tAccount,$sLogin,$sHashPassword)){ return 'Mauvais login/mot de passe'; } _root::redirect('comptes::new'); }
Lorsque je soumet le formulaire MKF me retourne l'erreur suivante:
Quelqu'un peut-il m'expliquer pourquoi?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 Undefined offset: 1 #0 C:\xampp\htdocs\MKF\data\genere\e-tmg\plugin\plugin_xsrf.php(116): exception_error_handler(8, 'Undefined offse...', 'C:\\xampp\\htdocs...', 116, Array) #1 C:\xampp\htdocs\MKF\data\genere\e-tmg\module\inscriptions\main.php(47): plugin_xsrf->checkToken(NULL) #2 C:\xampp\htdocs\MKF\data\genere\e-tmg\module\inscriptions\main.php(22): module_inscriptions->processEtape1() #3 C:\xampp\htdocs\MKF\lib\framework\class_root.php(263): module_inscriptions->_etape1() #4 C:\xampp\htdocs\MKF\data\genere\e-tmg\public\index.php(47): _root->run() #5 {main} Detail: #0 C:\xampp\htdocs\MKF\data\genere\e-tmg\plugin\plugin_xsrf.php (116) exception_error_handler( , 'Undefined offset: 1' , 'C:\xampp\htdocs\MKF\data\genere\e-tmg\plugin\plugin_xsrf.php' , , Array ( [sInputToken] => [tToken] => Array ( [0] => ) [iTime] => ) ) #1 C:\xampp\htdocs\MKF\data\genere\e-tmg\module\inscriptions\main.php (47) plugin_xsrf -> checkToken( NULL ) #2 C:\xampp\htdocs\MKF\data\genere\e-tmg\module\inscriptions\main.php (22) module_inscriptions -> processEtape1( ) #3 C:\xampp\htdocs\MKF\lib\framework\class_root.php (263) module_inscriptions -> _etape1( ) #4 C:\xampp\htdocs\MKF\data\genere\e-tmg\public\index.php (47) _root -> run( ) #5 {main} Fichier : C:\xampp\htdocs\MKF\data\genere\e-tmg\plugin\plugin_xsrf.php ligne 116 Message : Undefined offset: 1
Partager