MAPG-69 ability to reset signup filled after login attempt

This commit is contained in:
Bence Pőcze 2020-06-21 14:36:00 +02:00
parent 285f2dd0ac
commit a8777b897b
5 changed files with 31 additions and 2 deletions

View File

@ -354,6 +354,12 @@ div.box {
padding: 0; padding: 0;
width: 100%; width: 100%;
} }
button.marginLeft, a.button.marginLeft {
margin-left: 0;
}
button.marginRight, a.button.marginRight {
margin-right: 0;
}
div.modal { div.modal {
left: 20px; left: 20px;
right: 20px; right: 20px;

View File

@ -46,4 +46,15 @@
window.location.replace('/signup/success'); window.location.replace('/signup/success');
}, formData); }, formData);
}; };
var resetSignupButton = document.getElementById('resetSignupButton');
if (resetSignupButton) {
resetSignupButton.onclick = function () {
document.getElementById('loading').style.visibility = 'visible';
MapGuesser.httpRequest('POST', '/signup/reset', function () {
window.location.reload();
});
};
}
})(); })();

View File

@ -291,6 +291,14 @@ class LoginController
return new JsonContent($data); return new JsonContent($data);
} }
public function resetSignup(): IContent
{
$this->request->session()->delete('tmp_user_data');
$data = ['success' => true];
return new JsonContent($data);
}
public function activate() public function activate()
{ {
if ($this->request->user() !== null) { if ($this->request->user() !== null) {

View File

@ -19,8 +19,11 @@ $jsFiles = [
<input class="big fullWidth marginTop" type="password" name="password_confirm" placeholder="Password confirmation" minlength="6"> <input class="big fullWidth marginTop" type="password" name="password_confirm" placeholder="Password confirmation" minlength="6">
<?php endif; ?> <?php endif; ?>
<p id="signupFormError" class="formError justify marginTop"></p> <p id="signupFormError" class="formError justify marginTop"></p>
<div class="right marginTop"> <div class="right">
<button type="submit">Sign up</button> <button class="marginTop" type="submit">Sign up</button><!--
--><?php if (isset($email)): ?><!--
--><button id="resetSignupButton" class="gray marginTop marginLeft" type="button">Reset</button>
<?php endif; ?>
</div> </div>
<hr> <hr>
<div class="center"> <div class="center">

View File

@ -21,6 +21,7 @@ Container::$routeCollection->get('signup', 'signup', [MapGuesser\Controller\Logi
Container::$routeCollection->post('signup-action', 'signup', [MapGuesser\Controller\LoginController::class, 'signup']); Container::$routeCollection->post('signup-action', 'signup', [MapGuesser\Controller\LoginController::class, 'signup']);
Container::$routeCollection->get('signup-google', 'signup/google', [MapGuesser\Controller\LoginController::class, 'getSignupWithGoogleForm']); Container::$routeCollection->get('signup-google', 'signup/google', [MapGuesser\Controller\LoginController::class, 'getSignupWithGoogleForm']);
Container::$routeCollection->post('signup-google-action', 'signup/google', [MapGuesser\Controller\LoginController::class, 'signupWithGoogle']); Container::$routeCollection->post('signup-google-action', 'signup/google', [MapGuesser\Controller\LoginController::class, 'signupWithGoogle']);
Container::$routeCollection->post('signup.reset', 'signup/reset', [MapGuesser\Controller\LoginController::class, 'resetSignup']);
Container::$routeCollection->get('signup.success', 'signup/success', [MapGuesser\Controller\LoginController::class, 'getSignupSuccess']); Container::$routeCollection->get('signup.success', 'signup/success', [MapGuesser\Controller\LoginController::class, 'getSignupSuccess']);
Container::$routeCollection->get('signup.activate', 'signup/activate/{token}', [MapGuesser\Controller\LoginController::class, 'activate']); Container::$routeCollection->get('signup.activate', 'signup/activate/{token}', [MapGuesser\Controller\LoginController::class, 'activate']);
Container::$routeCollection->get('signup.cancel', 'signup/cancel/{token}', [MapGuesser\Controller\LoginController::class, 'cancel']); Container::$routeCollection->get('signup.cancel', 'signup/cancel/{token}', [MapGuesser\Controller\LoginController::class, 'cancel']);