Compare commits
12
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1a4d928143 | ||
|
|
b35668c2fb | ||
|
|
5814620b4f | ||
|
|
64b6197bd4 | ||
|
|
1be51b3e07 | ||
|
|
43775c8f4f | ||
|
|
95eb956403 | ||
|
|
ce96e15911 | ||
|
|
3726573f4c | ||
|
|
a8913b0d44 | ||
|
|
e014bf9dc1 | ||
|
|
50c7e3972c |
No files matched your search
@@ -251,7 +251,7 @@ div.modal {
|
|||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
z-index: 3;
|
z-index: 6;
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -263,7 +263,7 @@ div.modal {
|
|||||||
right: 0;
|
right: 0;
|
||||||
background-color: #000000;
|
background-color: #000000;
|
||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
z-index: 2;
|
z-index: 5;
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -329,7 +329,7 @@ div.buttonContainer>button {
|
|||||||
left: 50%;
|
left: 50%;
|
||||||
margin-top: -32px;
|
margin-top: -32px;
|
||||||
margin-left: -32px;
|
margin-left: -32px;
|
||||||
z-index: 5;
|
z-index: 7;
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,8 +29,6 @@
|
|||||||
loginFormError.style.display = 'block';
|
loginFormError.style.display = 'block';
|
||||||
loginFormError.innerHTML = errorText;
|
loginFormError.innerHTML = errorText;
|
||||||
|
|
||||||
form.elements.email.select();
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,12 @@ var MapGuesser = {
|
|||||||
httpRequest: function (method, url, callback, data) {
|
httpRequest: function (method, url, callback, data) {
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
|
|
||||||
xhr.responseType = 'json';
|
|
||||||
xhr.onload = callback;
|
xhr.onload = callback;
|
||||||
|
|
||||||
xhr.open(method, url, true);
|
xhr.open(method, url, true);
|
||||||
|
|
||||||
|
xhr.responseType = 'json';
|
||||||
|
|
||||||
if (method === 'POST') {
|
if (method === 'POST') {
|
||||||
if (typeof data === 'undefined') {
|
if (typeof data === 'undefined') {
|
||||||
data = new FormData();
|
data = new FormData();
|
||||||
|
|||||||
@@ -37,15 +37,12 @@
|
|||||||
profileFormError.style.display = 'block';
|
profileFormError.style.display = 'block';
|
||||||
profileFormError.innerHTML = errorText;
|
profileFormError.innerHTML = errorText;
|
||||||
|
|
||||||
form.elements.password_new.select();
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
document.getElementById('profileFormError').style.display = 'none';
|
document.getElementById('profileFormError').style.display = 'none';
|
||||||
form.reset();
|
form.reset();
|
||||||
form.elements.save.disabled = true;
|
form.elements.save.disabled = true;
|
||||||
form.elements.password_new.focus();
|
|
||||||
}, formData);
|
}, formData);
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
@@ -14,6 +14,9 @@
|
|||||||
if (this.response.error) {
|
if (this.response.error) {
|
||||||
var errorText;
|
var errorText;
|
||||||
switch (this.response.error) {
|
switch (this.response.error) {
|
||||||
|
case 'email_not_valid':
|
||||||
|
errorText = 'The given email address is not valid.'
|
||||||
|
break;
|
||||||
case 'passwords_too_short':
|
case 'passwords_too_short':
|
||||||
errorText = 'The given password is too short. Please choose a password that is at least 6 characters long!'
|
errorText = 'The given password is too short. Please choose a password that is at least 6 characters long!'
|
||||||
break;
|
break;
|
||||||
@@ -32,14 +35,11 @@
|
|||||||
signupFormError.style.display = 'block';
|
signupFormError.style.display = 'block';
|
||||||
signupFormError.innerHTML = errorText;
|
signupFormError.innerHTML = errorText;
|
||||||
|
|
||||||
form.elements.email.select();
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
document.getElementById('signupFormError').style.display = 'none';
|
document.getElementById('signupFormError').style.display = 'none';
|
||||||
form.reset();
|
form.reset();
|
||||||
form.elements.email.focus();
|
|
||||||
|
|
||||||
MapGuesser.showModalWithContent('Sign up successful', 'Sign up was successful. Please check your email and click on the activation link to activate your account!');
|
MapGuesser.showModalWithContent('Sign up successful', 'Sign up was successful. Please check your email and click on the activation link to activate your account!');
|
||||||
}, formData);
|
}, formData);
|
||||||
|
|||||||
@@ -43,6 +43,11 @@ class SignupController
|
|||||||
return new JsonContent($data);
|
return new JsonContent($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (filter_var($this->request->post('email'), FILTER_VALIDATE_EMAIL) === false) {
|
||||||
|
$data = ['error' => 'email_not_valid'];
|
||||||
|
return new JsonContent($data);
|
||||||
|
}
|
||||||
|
|
||||||
$select = new Select(\Container::$dbConnection, 'users');
|
$select = new Select(\Container::$dbConnection, 'users');
|
||||||
$select->columns(User::getFields());
|
$select->columns(User::getFields());
|
||||||
$select->where('email', '=', $this->request->post('email'));
|
$select->where('email', '=', $this->request->post('email'));
|
||||||
|
|||||||
@@ -58,6 +58,8 @@ class UserController implements ISecured
|
|||||||
$modify->fill($user->toArray());
|
$modify->fill($user->toArray());
|
||||||
$modify->save();
|
$modify->save();
|
||||||
|
|
||||||
|
$this->request->session()->set('user', $user);
|
||||||
|
|
||||||
$data = ['success' => true];
|
$data = ['success' => true];
|
||||||
return new JsonContent($data);
|
return new JsonContent($data);
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -9,8 +9,8 @@ $jsFiles = [
|
|||||||
<h2>Login</h2>
|
<h2>Login</h2>
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<form id="loginForm" action="/login" method="post">
|
<form id="loginForm" action="/login" method="post">
|
||||||
<input class="big fullWidth" type="email" name="email" placeholder="Email address" autofocus>
|
<input class="big fullWidth" type="email" name="email" placeholder="Email address" required autofocus>
|
||||||
<input class="big fullWidth marginTop" type="password" name="password" placeholder="Password">
|
<input class="big fullWidth marginTop" type="password" name="password" placeholder="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">
|
||||||
<button type="submit">Login</button>
|
<button type="submit">Login</button>
|
||||||
|
|||||||
+4
-4
@@ -9,12 +9,12 @@ $jsFiles = [
|
|||||||
<h2>Profile</h2>
|
<h2>Profile</h2>
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<form id="profileForm" action="/profile" method="post">
|
<form id="profileForm" action="/profile" method="post">
|
||||||
|
<input class="big fullWidth" type="password" name="password" placeholder="Current password" autofocus>
|
||||||
|
<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" autofocus>
|
<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">
|
<input class="big fullWidth marginTop" type="password" name="password_new_confirm" placeholder="New password confirmation" minlength="6">
|
||||||
<hr>
|
|
||||||
<input class="big fullWidth" type="password" name="password" placeholder="Current password">
|
|
||||||
<p id="profileFormError" class="formError justify marginTop"></p>
|
<p id="profileFormError" 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>
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ $jsFiles = [
|
|||||||
<h2>Sign up</h2>
|
<h2>Sign up</h2>
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<form id="signupForm" action="/signup" method="post">
|
<form id="signupForm" action="/signup" method="post">
|
||||||
<input class="big fullWidth" type="email" name="email" placeholder="Email address" autofocus>
|
<input class="big fullWidth" type="email" name="email" placeholder="Email address" required autofocus>
|
||||||
<input class="big fullWidth marginTop" type="password" name="password" placeholder="Password">
|
<input class="big fullWidth marginTop" type="password" name="password" placeholder="Password" required minlength="6">
|
||||||
<input class="big fullWidth marginTop" type="password" name="password_confirm" placeholder="Password confirmation">
|
<input class="big fullWidth marginTop" type="password" name="password_confirm" placeholder="Password confirmation" required minlength="6">
|
||||||
<p id="signupFormError" class="formError justify marginTop"></p>
|
<p id="signupFormError" class="formError justify marginTop"></p>
|
||||||
<div class="right marginTop">
|
<div class="right marginTop">
|
||||||
<button type="submit">Sign up</button>
|
<button type="submit">Sign up</button>
|
||||||
|
|||||||
Reference in new issue
Block a user