Compare commits
No commits in common. "0a7d248a3e3a0e12ce6b1a532b0710f79cbf2f76" and "d7338b84d3485da1ff1d8ffda25b4f66712c1912" have entirely different histories.
0a7d248a3e
...
d7338b84d3
@ -81,11 +81,13 @@ class LoginController
|
|||||||
|
|
||||||
if (\Container::$request->session()->has('tmp_user_data')) {
|
if (\Container::$request->session()->has('tmp_user_data')) {
|
||||||
$tmpUserData = \Container::$request->session()->get('tmp_user_data');
|
$tmpUserData = \Container::$request->session()->get('tmp_user_data');
|
||||||
|
|
||||||
|
$data = ['email' => $tmpUserData['email']];
|
||||||
} else {
|
} else {
|
||||||
$tmpUserData = [];
|
$data = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
return new HtmlContent('login/signup', $tmpUserData);
|
return new HtmlContent('login/signup', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSignupSuccess()
|
public function getSignupSuccess()
|
||||||
@ -157,13 +159,6 @@ class LoginController
|
|||||||
return new JsonContent(['success' => true]);
|
return new JsonContent(['success' => true]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
|
||||||
filter_var(\Container::$request->post('email'), FILTER_VALIDATE_EMAIL) === false &&
|
|
||||||
preg_match('/^[a-zA-Z0-9_\-\.]+$/', \Container::$request->post('email')) !== 1
|
|
||||||
) {
|
|
||||||
return new JsonContent(['error' => ['errorText' => 'This is not a valid email address or username.']]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$user = $this->userRepository->getByEmailOrUsername(\Container::$request->post('email'));
|
$user = $this->userRepository->getByEmailOrUsername(\Container::$request->post('email'));
|
||||||
|
|
||||||
if ($user === null) {
|
if ($user === null) {
|
||||||
@ -178,14 +173,10 @@ class LoginController
|
|||||||
$tmpUser = new User();
|
$tmpUser = new User();
|
||||||
$tmpUser->setPlainPassword(\Container::$request->post('password'));
|
$tmpUser->setPlainPassword(\Container::$request->post('password'));
|
||||||
|
|
||||||
$tmpUserData = ['password_hashed' => $tmpUser->getPassword()];
|
\Container::$request->session()->set('tmp_user_data', [
|
||||||
if (filter_var(\Container::$request->post('email'), FILTER_VALIDATE_EMAIL) === false) {
|
'email' => \Container::$request->post('email'),
|
||||||
$tmpUserData['username'] = \Container::$request->post('email');
|
'password_hashed' => $tmpUser->getPassword()
|
||||||
} else {
|
]);
|
||||||
$tmpUserData['email'] = \Container::$request->post('email');
|
|
||||||
}
|
|
||||||
|
|
||||||
\Container::$request->session()->set('tmp_user_data', $tmpUserData);
|
|
||||||
|
|
||||||
return new JsonContent([
|
return new JsonContent([
|
||||||
'redirect' => [
|
'redirect' => [
|
||||||
@ -507,13 +498,6 @@ class LoginController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
|
||||||
filter_var(\Container::$request->post('email'), FILTER_VALIDATE_EMAIL) === false &&
|
|
||||||
preg_match('/^[a-zA-Z0-9_\-\.]+$/', \Container::$request->post('email')) !== 1
|
|
||||||
) {
|
|
||||||
return new JsonContent(['error' => ['errorText' => 'This is not a valid email address or username.']]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$user = $this->userRepository->getByEmailOrUsername(\Container::$request->post('email'));
|
$user = $this->userRepository->getByEmailOrUsername(\Container::$request->post('email'));
|
||||||
|
|
||||||
if ($user === null) {
|
if ($user === null) {
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<h2>Login</h2>
|
<h2>Login</h2>
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<form id="loginForm" action="/login" method="post" data-redirect-on-success="<?= $redirectUrl ?>">
|
<form id="loginForm" action="/login" method="post" data-redirect-on-success="<?= $redirectUrl ?>">
|
||||||
<input type="text" class="text big fullWidth" name="email" placeholder="Email address / username" autocomplete="username" required autofocus>
|
<input type="email" class="text big fullWidth" name="email" placeholder="Email address / username" autocomplete="username" required autofocus>
|
||||||
<input type="password" class="text big fullWidth marginTop" name="password" placeholder="Password" autocomplete="current-password" required minlength="6">
|
<input type="password" class="text big fullWidth marginTop" name="password" placeholder="Password" autocomplete="current-password" required minlength="6">
|
||||||
<p id="loginFormError" class="formError justify marginTop"></p>
|
<p id="loginFormError" class="formError justify marginTop"></p>
|
||||||
<div class="right marginTop">
|
<div class="right marginTop">
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<h2>Request password reset</h2>
|
<h2>Request password reset</h2>
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<form id="passwordResetForm" action="/password/requestReset" method="post" data-redirect-on-success="/password/requestReset/success">
|
<form id="passwordResetForm" action="/password/requestReset" method="post" data-redirect-on-success="/password/requestReset/success">
|
||||||
<input type="text" class="text big fullWidth" name="email" placeholder="Email address / username" autocomplete="username" value="<?= isset($email) ? $email : '' ?>" required autofocus>
|
<input type="email" class="text big fullWidth" name="email" placeholder="Email address / username" autocomplete="username" value="<?= isset($email) ? $email : '' ?>" required autofocus>
|
||||||
<?php if (!empty($_ENV['RECAPTCHA_SITEKEY'])): ?>
|
<?php if (!empty($_ENV['RECAPTCHA_SITEKEY'])): ?>
|
||||||
<div class="marginTop">
|
<div class="marginTop">
|
||||||
<div class="g-recaptcha" data-sitekey="<?= $_ENV['RECAPTCHA_SITEKEY'] ?>"></div>
|
<div class="g-recaptcha" data-sitekey="<?= $_ENV['RECAPTCHA_SITEKEY'] ?>"></div>
|
||||||
|
@ -7,25 +7,16 @@
|
|||||||
<h2>Sign up</h2>
|
<h2>Sign up</h2>
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<form id="signupForm" action="/signup" method="post" data-redirect-on-success="/signup/success">
|
<form id="signupForm" action="/signup" method="post" data-redirect-on-success="/signup/success">
|
||||||
<?php if (isset($email) || isset($username)): ?>
|
<?php if (isset($email)): ?>
|
||||||
<p class="justify">No user found with the given email address / username. Sign up with one click!</p>
|
<p class="justify">No user found with the given email address / username. Sign up with one click!</p>
|
||||||
<?php if (isset($email)): ?>
|
<input type="email" class="text big fullWidth marginTop" name="email" placeholder="Email address" autocomplete="username" value="<?= $email ?>" required>
|
||||||
<input type="email" class="text big fullWidth marginTop" name="email" placeholder="Email address" autocomplete="username" value="<?= $email ?>" required>
|
<input type="password" class="text big fullWidth marginTop" name="password" placeholder="Password confirmation" autocomplete="new-password" required minlength="6" autofocus>
|
||||||
<?php else: ?>
|
|
||||||
<input type="email" class="text big fullWidth marginTop" name="email" placeholder="Email address" autocomplete="username" required autofocus>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if (isset($username)): ?>
|
|
||||||
<input type="username" class="text big fullWidth marginTop" name="username" placeholder="Username" value="<?= $username ?>">
|
|
||||||
<?php else: ?>
|
|
||||||
<input type="username" class="text big fullWidth marginTop" name="username" placeholder="Username" autofocus>
|
|
||||||
<?php endif; ?>
|
|
||||||
<input type="password" class="text big fullWidth marginTop" name="password" placeholder="Password confirmation" autocomplete="new-password" required minlength="6">
|
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<input type="email" class="text big fullWidth" name="email" placeholder="Email address" autocomplete="username" required autofocus>
|
<input type="email" class="text big fullWidth" name="email" placeholder="Email address" autocomplete="username" required autofocus>
|
||||||
<input type="username" class="text big fullWidth marginTop" name="username" placeholder="Username">
|
|
||||||
<input type="password" class="text big fullWidth marginTop" name="password" placeholder="Password" autocomplete="new-password" required minlength="6">
|
<input type="password" class="text big fullWidth marginTop" name="password" placeholder="Password" autocomplete="new-password" required minlength="6">
|
||||||
<input type="password" class="text big fullWidth marginTop" name="password_confirm" placeholder="Password confirmation" autocomplete="new-password" minlength="6">
|
<input type="password" class="text big fullWidth marginTop" name="password_confirm" placeholder="Password confirmation" autocomplete="new-password" minlength="6">
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
<input type="username" class="text big fullWidth marginTop" name="username" placeholder="Username">
|
||||||
<?php if (!empty($_ENV['RECAPTCHA_SITEKEY'])): ?>
|
<?php if (!empty($_ENV['RECAPTCHA_SITEKEY'])): ?>
|
||||||
<div class="marginTop">
|
<div class="marginTop">
|
||||||
<div class="g-recaptcha" data-sitekey="<?= $_ENV['RECAPTCHA_SITEKEY'] ?>"></div>
|
<div class="g-recaptcha" data-sitekey="<?= $_ENV['RECAPTCHA_SITEKEY'] ?>"></div>
|
||||||
|
Loading…
Reference in New Issue
Block a user