MAPG-156 rename profile to account
This commit is contained in:
parent
e2067627c4
commit
ad24f8ac28
@ -1,5 +1,5 @@
|
|||||||
(function () {
|
(function () {
|
||||||
var form = document.getElementById('profileForm');
|
var form = document.getElementById('accountForm');
|
||||||
|
|
||||||
form.elements.password_new.onkeyup = function () {
|
form.elements.password_new.onkeyup = function () {
|
||||||
MapGuesser.toggleDisableOnChange(this, form.elements.save);
|
MapGuesser.toggleDisableOnChange(this, form.elements.save);
|
||||||
@ -33,14 +33,14 @@
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
var profileFormError = document.getElementById('profileFormError');
|
var accountFormError = document.getElementById('accountFormError');
|
||||||
profileFormError.style.display = 'block';
|
accountFormError.style.display = 'block';
|
||||||
profileFormError.innerHTML = errorText;
|
accountFormError.innerHTML = errorText;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
document.getElementById('profileFormError').style.display = 'none';
|
document.getElementById('accountFormError').style.display = 'none';
|
||||||
form.reset();
|
form.reset();
|
||||||
form.elements.save.disabled = true;
|
form.elements.save.disabled = true;
|
||||||
}, formData);
|
}, formData);
|
@ -27,7 +27,7 @@ class UserController implements ISecured
|
|||||||
return $user !== null;
|
return $user !== null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getProfile(): IContent
|
public function getAccount(): IContent
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var User $user
|
* @var User $user
|
||||||
@ -35,10 +35,10 @@ class UserController implements ISecured
|
|||||||
$user = $this->request->user();
|
$user = $this->request->user();
|
||||||
|
|
||||||
$data = ['user' => $user->toArray()];
|
$data = ['user' => $user->toArray()];
|
||||||
return new HtmlContent('profile', $data);
|
return new HtmlContent('account', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function saveProfile(): IContent
|
public function saveAccount(): IContent
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var User $user
|
* @var User $user
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
<?php
|
<?php
|
||||||
$jsFiles = [
|
$jsFiles = [
|
||||||
'js/profile.js',
|
'js/account.js',
|
||||||
];
|
];
|
||||||
?>
|
?>
|
||||||
<?php require ROOT . '/views/templates/main_header.php'; ?>
|
<?php require ROOT . '/views/templates/main_header.php'; ?>
|
||||||
<?php require ROOT . '/views/templates/header.php'; ?>
|
<?php require ROOT . '/views/templates/header.php'; ?>
|
||||||
<h2>Profile</h2>
|
<h2>Account</h2>
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<form id="profileForm" action="/profile" method="post">
|
<form id="accountForm" action="/account" method="post">
|
||||||
<input class="big fullWidth" type="password" name="password" placeholder="Current password" autofocus>
|
<input class="big fullWidth" type="password" name="password" placeholder="Current password" autofocus>
|
||||||
<hr>
|
<hr>
|
||||||
<?php /* TODO: disabled for the time being, email modification should be implemented */ ?>
|
<?php /* TODO: disabled for the time being, email modification should be implemented */ ?>
|
||||||
<input class="big fullWidth" type="email" name="email" placeholder="Email address" value="<?= $user['email'] ?>" disabled>
|
<input class="big fullWidth" type="email" name="email" placeholder="Email address" value="<?= $user['email'] ?>" disabled>
|
||||||
<input class="big fullWidth marginTop" type="password" name="password_new" placeholder="New password" minlength="6">
|
<input class="big fullWidth marginTop" type="password" name="password_new" placeholder="New password" minlength="6">
|
||||||
<input class="big fullWidth marginTop" type="password" name="password_new_confirm" placeholder="New password confirmation" minlength="6">
|
<input class="big fullWidth marginTop" type="password" name="password_new_confirm" placeholder="New password confirmation" minlength="6">
|
||||||
<p id="profileFormError" class="formError justify marginTop"></p>
|
<p id="accountFormError" class="formError justify marginTop"></p>
|
||||||
<div class="right marginTop">
|
<div class="right marginTop">
|
||||||
<button type="submit" name="save" disabled>Save</button>
|
<button type="submit" name="save" disabled>Save</button>
|
||||||
</div>
|
</div>
|
@ -7,7 +7,7 @@
|
|||||||
</h1>
|
</h1>
|
||||||
<p>
|
<p>
|
||||||
<?php if (Container::$request->user()) : ?>
|
<?php if (Container::$request->user()) : ?>
|
||||||
<span><a href="/profile" title="Profile">
|
<span><a href="/account" title="Account">
|
||||||
<?php /* Copyright (c) 2019 The Bootstrap Authors. License can be found in 'USED_SOFTWARE' in section 'Bootstrap Icons'. */ ?>
|
<?php /* Copyright (c) 2019 The Bootstrap Authors. License can be found in 'USED_SOFTWARE' in section 'Bootstrap Icons'. */ ?>
|
||||||
<svg class="inline" width="1em" height="1em" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
|
<svg class="inline" width="1em" height="1em" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
|
||||||
<path fill-rule="evenodd" d="M3 14s-1 0-1-1 1-4 6-4 6 3 6 4-1 1-1 1H3zm5-6a3 3 0 1 0 0-6 3 3 0 0 0 0 6z"/>
|
<path fill-rule="evenodd" d="M3 14s-1 0-1-1 1-4 6-4 6 3 6 4-1 1-1 1H3zm5-6a3 3 0 1 0 0-6 3 3 0 0 0 0 6z"/>
|
||||||
|
6
web.php
6
web.php
@ -32,9 +32,9 @@ Container::$routeCollection->group('signup', function (MapGuesser\Routing\RouteC
|
|||||||
$routeCollection->get('signup.cancel', 'cancel/{token}', [MapGuesser\Controller\LoginController::class, 'cancel']);
|
$routeCollection->get('signup.cancel', 'cancel/{token}', [MapGuesser\Controller\LoginController::class, 'cancel']);
|
||||||
});
|
});
|
||||||
Container::$routeCollection->get('logout', 'logout', [MapGuesser\Controller\LoginController::class, 'logout']);
|
Container::$routeCollection->get('logout', 'logout', [MapGuesser\Controller\LoginController::class, 'logout']);
|
||||||
Container::$routeCollection->group('profile', function (MapGuesser\Routing\RouteCollection $routeCollection) {
|
Container::$routeCollection->group('account', function (MapGuesser\Routing\RouteCollection $routeCollection) {
|
||||||
$routeCollection->get('profile', '', [MapGuesser\Controller\UserController::class, 'getProfile']);
|
$routeCollection->get('account', '', [MapGuesser\Controller\UserController::class, 'getAccount']);
|
||||||
$routeCollection->post('profile-action', '', [MapGuesser\Controller\UserController::class, 'saveProfile']);
|
$routeCollection->post('account-action', '', [MapGuesser\Controller\UserController::class, 'saveAccount']);
|
||||||
});
|
});
|
||||||
//Container::$routeCollection->get('maps', 'maps', [MapGuesser\Controller\MapsController::class, 'getMaps']);
|
//Container::$routeCollection->get('maps', 'maps', [MapGuesser\Controller\MapsController::class, 'getMaps']);
|
||||||
Container::$routeCollection->group('game', function (MapGuesser\Routing\RouteCollection $routeCollection) {
|
Container::$routeCollection->group('game', function (MapGuesser\Routing\RouteCollection $routeCollection) {
|
||||||
|
Loading…
Reference in New Issue
Block a user