Skip to content

Commit 60ee001

Browse files
committed
update for AuthControllerConfig scaffolding
1 parent 31863b7 commit 60ee001

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/Ubiquity/scaffolding/ScaffoldController.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ abstract class ScaffoldController {
5555
"create" => "@framework/auth/create.html",
5656
"stepTwo" => "@framework/auth/stepTwo.html",
5757
"badTwoFACode" => "@framework/auth/badTwoFACode.html",
58-
"baseTemplate" => "@framework/auth/baseTemplate.html"
58+
"baseTemplate" => "@framework/auth/baseTemplate.html",
59+
"initRecovery" => "@framework/auth/initRecovery.html",
60+
"recovery" => "@framework/auth/recovery.html"
5961
]
6062
];
6163

src/Ubiquity/scaffolding/creators/AuthControllerCreator.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,21 @@ public function __construct($controllerName, $baseClass, $views = null, $routePa
2626
public function create(ScaffoldController $scaffoldController) {
2727
$this->scaffoldController = $scaffoldController;
2828
$classContent = '';
29-
if ($this->baseClass == "\\Ubiquity\\controllers\\auth\\AuthController") {
29+
$rClass=new \ReflectionClass($this->baseClass);
30+
if ($rClass->isAbstract()) {
3031
$controllerTemplate = "authController.tpl";
3132
$this->uses = [
3233
"Ubiquity\\utils\\http\\USession" => true,
3334
"Ubiquity\\utils\\http\\URequest" => true
3435
];
36+
if($this->baseClass=='\\Ubiquity\\controllers\\auth\\AuthControllerConfig'){
37+
$filename=\lcfirst($this->controllerName);
38+
$classContent.=$scaffoldController->_createMethod('protected','getConfigFilename','',': string ',"\t\treturn '$filename';");
39+
$completeClassname = $this->controllerNS . "auth\\".$this->controllerName;
40+
if(\method_exists($this->baseClass,'init')){
41+
\call_user_func($this->baseClass."::init",$filename);
42+
}
43+
}
3544
} else {
3645
$controllerTemplate = 'authController_.tpl';
3746
}

0 commit comments

Comments
 (0)