Display current e-mail address in settings.
This commit is contained in:
parent
e1ab3bf84c
commit
031a7f1413
4 changed files with 35 additions and 10 deletions
|
@ -7,6 +7,10 @@
|
||||||
&:focus {
|
&:focus {
|
||||||
border-color: #9475b2;
|
border-color: #9475b2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&--readonly {
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.mio--dark .input__text {
|
.mio--dark .input__text {
|
||||||
|
|
|
@ -42,3 +42,7 @@ method = null
|
||||||
; encryption = tls
|
; encryption = tls
|
||||||
; username = sys@misuzu.localhost
|
; username = sys@misuzu.localhost
|
||||||
; password = flashwaveiscool78
|
; password = flashwaveiscool78
|
||||||
|
|
||||||
|
[Exceptions]
|
||||||
|
report_url = http://misuzu-crash.localhost/report.php
|
||||||
|
hash_key = secret_key_used_to_make_a_hmac_sha256_hash
|
||||||
|
|
|
@ -4,7 +4,6 @@ use Misuzu\IO\File;
|
||||||
|
|
||||||
require_once __DIR__ . '/../misuzu.php';
|
require_once __DIR__ . '/../misuzu.php';
|
||||||
|
|
||||||
$db = Database::connection();
|
|
||||||
$tpl = $app->getTemplating();
|
$tpl = $app->getTemplating();
|
||||||
|
|
||||||
$queryOffset = (int)($_GET['o'] ?? 0);
|
$queryOffset = (int)($_GET['o'] ?? 0);
|
||||||
|
@ -148,7 +147,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
) {
|
) {
|
||||||
$updateAccountFields = [];
|
$updateAccountFields = [];
|
||||||
|
|
||||||
$fetchPassword = $db->prepare('
|
$fetchPassword = Database::prepare('
|
||||||
SELECT `password`
|
SELECT `password`
|
||||||
FROM `msz_users`
|
FROM `msz_users`
|
||||||
WHERE `user_id` = :user_id
|
WHERE `user_id` = :user_id
|
||||||
|
@ -222,7 +221,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($updateAccountFields) > 0) {
|
if (count($updateAccountFields) > 0) {
|
||||||
$updateUser = $db->prepare('
|
$updateUser = Database::prepare('
|
||||||
UPDATE `msz_users`
|
UPDATE `msz_users`
|
||||||
SET ' . pdo_prepare_array_update($updateAccountFields, true) . '
|
SET ' . pdo_prepare_array_update($updateAccountFields, true) . '
|
||||||
WHERE `user_id` = :user_id
|
WHERE `user_id` = :user_id
|
||||||
|
@ -298,7 +297,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$findSession = $db->prepare('
|
$findSession = Database::prepare('
|
||||||
SELECT `session_id`, `user_id`
|
SELECT `session_id`, `user_id`
|
||||||
FROM `msz_sessions`
|
FROM `msz_sessions`
|
||||||
WHERE `session_id` = :session_id
|
WHERE `session_id` = :session_id
|
||||||
|
@ -330,7 +329,7 @@ $tpl->var('settings_errors', $settingsErrors);
|
||||||
switch ($settingsMode) {
|
switch ($settingsMode) {
|
||||||
case 'account':
|
case 'account':
|
||||||
$profileFields = user_profile_fields_get();
|
$profileFields = user_profile_fields_get();
|
||||||
$getUserFields = $db->prepare('
|
$getUserFields = Database::prepare('
|
||||||
SELECT ' . pdo_prepare_array($profileFields, true, '`user_%s`') . '
|
SELECT ' . pdo_prepare_array($profileFields, true, '`user_%s`') . '
|
||||||
FROM `msz_users`
|
FROM `msz_users`
|
||||||
WHERE `user_id` = :user_id
|
WHERE `user_id` = :user_id
|
||||||
|
@ -338,10 +337,19 @@ switch ($settingsMode) {
|
||||||
$getUserFields->bindValue('user_id', $app->getUserId());
|
$getUserFields->bindValue('user_id', $app->getUserId());
|
||||||
$userFields = $getUserFields->execute() ? $getUserFields->fetch() : [];
|
$userFields = $getUserFields->execute() ? $getUserFields->fetch() : [];
|
||||||
|
|
||||||
|
$getMail = Database::prepare('
|
||||||
|
SELECT `email`
|
||||||
|
FROM `msz_users`
|
||||||
|
WHERE `user_id` = :user_id
|
||||||
|
');
|
||||||
|
$getMail->bindValue('user_id', $app->getUserId());
|
||||||
|
$currentEmail = $getMail->execute() ? $getMail->fetchColumn() : 'Failed to fetch e-mail address.';
|
||||||
|
|
||||||
$tpl->vars([
|
$tpl->vars([
|
||||||
'settings_profile_fields' => $profileFields,
|
'settings_profile_fields' => $profileFields,
|
||||||
'settings_profile_values' => $userFields,
|
'settings_profile_values' => $userFields,
|
||||||
'settings_disable_account_options' => $disableAccountOptions,
|
'settings_disable_account_options' => $disableAccountOptions,
|
||||||
|
'settings_email' => $currentEmail,
|
||||||
]);
|
]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -357,7 +365,7 @@ switch ($settingsMode) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'sessions':
|
case 'sessions':
|
||||||
$getSessionCount = $db->prepare('
|
$getSessionCount = Database::prepare('
|
||||||
SELECT COUNT(`session_id`)
|
SELECT COUNT(`session_id`)
|
||||||
FROM `msz_sessions`
|
FROM `msz_sessions`
|
||||||
WHERE `user_id` = :user_id
|
WHERE `user_id` = :user_id
|
||||||
|
@ -365,7 +373,7 @@ switch ($settingsMode) {
|
||||||
$getSessionCount->bindValue('user_id', $app->getUserId());
|
$getSessionCount->bindValue('user_id', $app->getUserId());
|
||||||
$sessionCount = $getSessionCount->execute() ? $getSessionCount->fetchColumn() : 0;
|
$sessionCount = $getSessionCount->execute() ? $getSessionCount->fetchColumn() : 0;
|
||||||
|
|
||||||
$getSessions = $db->prepare('
|
$getSessions = Database::prepare('
|
||||||
SELECT
|
SELECT
|
||||||
`session_id`, `session_country`, `user_agent`, `created_at`, `expires_on`,
|
`session_id`, `session_country`, `user_agent`, `created_at`, `expires_on`,
|
||||||
INET6_NTOA(`session_ip`) as `session_ip_decoded`
|
INET6_NTOA(`session_ip`) as `session_ip_decoded`
|
||||||
|
@ -389,7 +397,7 @@ switch ($settingsMode) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'login-history':
|
case 'login-history':
|
||||||
$getLoginAttemptsCount = $db->prepare('
|
$getLoginAttemptsCount = Database::prepare('
|
||||||
SELECT COUNT(`attempt_id`)
|
SELECT COUNT(`attempt_id`)
|
||||||
FROM `msz_login_attempts`
|
FROM `msz_login_attempts`
|
||||||
WHERE `user_id` = :user_id
|
WHERE `user_id` = :user_id
|
||||||
|
@ -397,7 +405,7 @@ switch ($settingsMode) {
|
||||||
$getLoginAttemptsCount->bindValue('user_id', $app->getUserId());
|
$getLoginAttemptsCount->bindValue('user_id', $app->getUserId());
|
||||||
$loginAttemptsCount = $getLoginAttemptsCount->execute() ? $getLoginAttemptsCount->fetchColumn() : 0;
|
$loginAttemptsCount = $getLoginAttemptsCount->execute() ? $getLoginAttemptsCount->fetchColumn() : 0;
|
||||||
|
|
||||||
$getLoginAttempts = $db->prepare('
|
$getLoginAttempts = Database::prepare('
|
||||||
SELECT
|
SELECT
|
||||||
`attempt_id`, `attempt_country`, `was_successful`, `user_agent`, `created_at`,
|
`attempt_id`, `attempt_country`, `was_successful`, `user_agent`, `created_at`,
|
||||||
INET6_NTOA(`attempt_ip`) as `attempt_ip_decoded`
|
INET6_NTOA(`attempt_ip`) as `attempt_ip_decoded`
|
||||||
|
|
|
@ -37,7 +37,16 @@
|
||||||
|
|
||||||
<label class="settings__account__input">
|
<label class="settings__account__input">
|
||||||
<div class="settings__account__input__name">
|
<div class="settings__account__input__name">
|
||||||
New E-mail Address
|
Current e-mail address
|
||||||
|
</div>
|
||||||
|
<div class="settings__account__input__value">
|
||||||
|
<input type="text" class="input__text input__text--readonly settings__account__input__value__text" readonly value="{{ settings_email }}">
|
||||||
|
</div>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<label class="settings__account__input">
|
||||||
|
<div class="settings__account__input__name">
|
||||||
|
New e-mail Address
|
||||||
</div>
|
</div>
|
||||||
<div class="settings__account__input__value">
|
<div class="settings__account__input__value">
|
||||||
<input type="text" name="email[new]" class="input__text settings__account__input__value__text">
|
<input type="text" name="email[new]" class="input__text settings__account__input__value__text">
|
||||||
|
|
Loading…
Reference in a new issue