Skip to content

Commit dc66ccc

Browse files
committed
Add Forget Password Link
1 parent 8fd77cc commit dc66ccc

File tree

5 files changed

+17
-26
lines changed

5 files changed

+17
-26
lines changed

src/WebApp/Application.php

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function init() {
4646
protected function initVault() {
4747
if ($this->config->has('vault')) {
4848
$this->vault = \TgVault\VaultFactory::create($this->config->get('vault'));
49-
// TODO $this->vault->setLogger(new WLogger());
49+
// TODO $this->vault->setLogger(Log::instance());
5050
}
5151
}
5252

@@ -183,16 +183,6 @@ public function getCssFiles() {
183183
return array();
184184
}
185185

186-
/** TODO */
187-
protected function createRestPage() {
188-
return new RestPage($this);
189-
}
190-
191-
/** TODO */
192-
public function getRestService($serviceName, $restPath) {
193-
return NULL;
194-
}
195-
196186
public function getPrincipal() {
197187
// Retrieve from session
198188
if (($this->principal == NULL) && isset($_SESSION['principal'])) {
@@ -237,16 +227,6 @@ public function getJavascript() {
237227
return array();
238228
}
239229

240-
/** TODO Unclear where it is used
241-
public function getAllowedTestType() {
242-
$rc = 'none';
243-
if (isset($this->config['allowedTestType'])) {
244-
$rc = $this->config['allowedTestType'];
245-
}
246-
return $rc;
247-
}
248-
*/
249-
250230
/**
251231
* Returns special defined page links or URIs for usage in various
252232
* contexts. Mostly used is 'login', 'logout', 'forget_password', 'home'.

src/WebApp/BootstrapTheme/DefaultLayout.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,10 @@ protected function renderNavbarContent() {
8080
if ($userMenu == NULL) {
8181
$userMenu = array();
8282
$userItem = new \WebApp\Component\MenuItem($this, $principal->__toString(), '#');
83-
$userMenu[] = new \WebApp\Component\MenuItem($userItem, 'logout_label', '?logout');
83+
$logoutLink = $this->app->getPageLink('logout');
84+
if ($logoutLink != NULL) $logoutLink = Utils::getAppPath($logoutLink);
85+
else $logoutLink = '';
86+
$userMenu[] = new \WebApp\Component\MenuItem($userItem, 'logout_label', $logoutLink.'?logout');
8487
$userMenu = array($userItem);
8588
}
8689
if (($userMenu != NULL) && is_array($userMenu)) {

src/WebApp/BootstrapTheme/LoginPage.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace WebApp\BootstrapTheme;
44

55
use WebApp\Component\Alert;
6+
use WebApp\Utils;
67

78
class LoginPage extends \WebApp\Page\LoginPage {
89

@@ -67,6 +68,13 @@ protected function getLoginForm() {
6768
$submit->addClass('btn-primary');
6869

6970
$rc[] = $form;
71+
if ($this->app->getPageLink('forgot_password') != NULL) {
72+
$link = Utils::getAppPath($this->app->getPageLink('forgot_password'));
73+
$forgot = new \WebApp\Component\Div($this, new \WebApp\Component\Link($this, $link, 'Passwort vergessen?'));
74+
$forgot->addClass('small');
75+
$forgot->setStyle('margin-top', '1em');
76+
$rc[] = $forgot;
77+
}
7078
return $rc;
7179
}
7280
}

src/WebApp/Component/Div.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
class Div extends Container {
66

7-
public function __construct($parent, string $text = NULL) {
8-
parent::__construct($parent, $text);
7+
public function __construct($parent, $child = NULL) {
8+
parent::__construct($parent, $child);
99
}
1010

1111
}

src/WebApp/Component/Paragraph.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
class Paragraph extends Container {
66

7-
public function __construct($parent, string $text = NULL) {
8-
parent::__construct($parent, $text);
7+
public function __construct($parent, $child = NULL) {
8+
parent::__construct($parent, $child);
99
}
1010

1111
}

0 commit comments

Comments
 (0)