Module Authentification/Inscription : Fatal Error
Bsr
Lors de l'utilisation de la derniere verison j'ai voulu faire un module simple avec connexion et inscription. Cela avait fonctionné avec la version précédente sans soucis.
Là j'ai comme retour :
Fatal error: Call to undefined method business_auth::registerNewAccount() in C:\wamp64\www\mkframework\data\genere\ityquery2\module\private\auth\main.php on line 62
avec
Call Stack
# Time Memory Function Location
1 0.0021 264296 {main}( ) ...\index.php:0
2 0.0048 502896 _root->run( ) ...\index.php:56
3 0.0156 779512 module_private_auth->_inscription( ) ...\class_root.php:264
4 0.0156 779728 module_private_auth->processInscription( ) ...\main.php:42
Le fichier auth\main.php a été généré par MK
Code:
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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
|
<?php
class module_private_auth extends module_private {
protected $_sModulePath = 'private/auth';
public function getView($sView_) {
return new _view($this->_sModulePath . '::' . $sView_);
}
public function _login() {
$sMessage = $this->checkLoginPass();
$oView = $this->getView('login');
$oView->sError = $sMessage;
$this->oLayout->add('main', $oView);
}
private function checkLoginPass() {
//if form is not sent, we stop there
if (!_root::getRequest()->isPost()) {
return null;
}
$sLogin = _root::getParam('login');
$sPassword = _root::getParam('password');
$oBusinessAuth = new business_auth(model_auth::getInstance(), _root::getAuth(), _root::getI18n() );
if (false === $oBusinessAuth->checkCredentials($sLogin, $sPassword)) {
return $oBusinessAuth->getReturn()->getData('error');
}
_root::redirect('global_default::index');
}
public function _inscription() {
$tMessage = $this->processInscription();
$oView = $this->getView('inscription');
$oView->tMessage = $tMessage;
$oView->oUser = new row_auth;
$this->oLayout->add('main', $oView);
}
private function processInscription() {
if (!_root::getRequest()->isPost()) {
return null;
}
$sLogin = _root::getParam('username');
$sPassword = _root::getParam('password');
$sPassword2 = _root::getParam('passwordConfirm');
$oBusinessAuth = new business_auth(model_auth::getInstance(), _root::getAuth(), _root::getI18n() );
if (false === $oBusinessAuth->registerNewAccount(new row_auth, $sLogin, $sPassword, $sPassword2)) {
return $oBusinessAuth->getReturn()->getData('tError');
}
return array('success' => array(tr('compteCreeAvecSucces')));
}
public function _logout() {
_root::getAuth()->logout();
}
} |
J'ai également hâte de voir comment utiliser la nouvelle version :-)
Merci d'avance