Skip to content

Commit

Permalink
better login and signup. support for custom themes
Browse files Browse the repository at this point in the history
  • Loading branch information
Praesidiarius committed Apr 12, 2021
1 parent 987c1ae commit 041c8d7
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/Controller/AuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,9 @@ public function signupAction() {
'email' => $sEmail,
'password' => password_hash($sPass, PASSWORD_DEFAULT),
];
if(isset(CoreController::$oSession->oRefUser)) {
$aUserData['ref_user_idfs'] = CoreController::$oSession->oRefUser->getID();
}
$aUserData = array_merge($aUserData,$aDefSettings);
$oNewUser->exchangeArray($aUserData);
$iNewUserID = $this->oTableGateway->saveSingle($oNewUser);
Expand Down
13 changes: 13 additions & 0 deletions src/Model/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,23 @@ public function exchangeArray(array $data)
if(array_key_exists('is_globaladmin',$data)) {
$this->is_globaladmin = ! empty($data['is_globaladmin']) ? $data['is_globaladmin'] : 0;
}
if(array_key_exists('telegram_chatid',$data)) {
$this->telegram_chatid = ! empty($data['telegram_chatid']) ? $data['telegram_chatid'] : '';
}

if(array_key_exists('token_balance',$data)) {
$this->token_balance = ! empty($data['token_balance']) ? $data['token_balance'] : 0;
$this->prefered_coin = ! empty($data['prefered_coin']) ? $data['prefered_coin'] : 'BCH';
}

if(array_key_exists('login_counter',$data)) {
$this->login_counter = !empty($data['login_counter']) ? $data['login_counter'] : 0;
}

if(array_key_exists('ref_user_idfs',$data)) {
$this->ref_user_idfs = ! empty($data['ref_user_idfs']) ? $data['ref_user_idfs'] : 0;
}

if(array_key_exists('function',$data)) {
$this->function = ! empty($data['function']) ? $data['function'] : '';
}
Expand Down
6 changes: 6 additions & 0 deletions src/Model/UserTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,12 @@ public function saveSingle(User $user)
if(isset($user->contact_idfs)) {
$data['contact_idfs'] = $user->contact_idfs;
}
if(isset($user->ref_user_idfs)) {
$data['ref_user_idfs'] = $user->ref_user_idfs;
}
if(isset($user->telegram_chatid)) {
$data['telegram_chatid'] = $user->telegram_chatid;
}

$iCreatorID = (isset(CoreController::$oSession->oUser)) ? CoreController::$oSession->oUser->getID() : 1;

Expand Down
2 changes: 1 addition & 1 deletion view/layout/login.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ use Application\Controller\CoreController;
<hr>
<footer>
<p>&copy; <?= date('Y') ?>
<a href="<?=CoreController::$aGlobalSettings['app-url']?>/impressum" target="_blank">
<a href="<?=CoreController::$aGlobalSettings['app-url']?>" target="_blank">
<?=CoreController::$aGlobalSettings['app-copyright']?>
</a>. <?=$this->translate('All rights reserved')?>.</p>
</footer>
Expand Down
7 changes: 7 additions & 0 deletions view/one-place/user/auth/forgot.phtml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
use Application\Controller\CoreController;
?>
<form action="" method="POST">
<h2>Forgot Password</h2>
Expand All @@ -19,6 +20,12 @@
<input type="text" id="plc_login_user" name="plc_login_user" value="" class="form-control" />
<label for="plc_login_user"><?=$this->translate('Username or E-Mail')?></label>
</div>
<?php if(isset(CoreController::$aGlobalSettings['recaptcha-forgot-sitekey'])) { ?>
<div class="md-form">
<div class="g-recaptcha" data-sitekey="<?=CoreController::$aGlobalSettings['recaptcha-forgot-sitekey']?>"></div>
</div>
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
<?php } ?>
<div class="md-form">
<button type="submit" value="Login" class="btn-floating btn btn-dark">
<?=$this->translate('Get Password Reset Link')?>
Expand Down

0 comments on commit 041c8d7

Please sign in to comment.