aboutsummaryrefslogtreecommitdiff
path: root/app/Controllers/userController.php
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2020-03-08 00:14:29 +0100
committerGravatar GitHub <noreply@github.com> 2020-03-08 00:14:29 +0100
commit51edbc1578fe49b281b39d91451d2b9df0092028 (patch)
treed82c6181797cbebe38e7a6dc5934237dc6597b15 /app/Controllers/userController.php
parent128b3367880fd18e4179123b4e533d14902b484c (diff)
Improve login and registration pages (#2794)
* Keep the user on login page on failure * Show an error if username already exists * Check the password format in the backend * Return a better message if username is invalid * Add a title to the login page * wip: Improve look of login and register pages * Set a capital M in username help message On the registration page, username tip started with a minuscule, while the password tip started with a capital. * Change message if username is taken
Diffstat (limited to 'app/Controllers/userController.php')
-rw-r--r--app/Controllers/userController.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/app/Controllers/userController.php b/app/Controllers/userController.php
index b5725e6b5..5da42f5a4 100644
--- a/app/Controllers/userController.php
+++ b/app/Controllers/userController.php
@@ -284,6 +284,27 @@ class FreshRSS_user_Controller extends Minz_ActionController {
$email = Minz_Request::param('new_user_email', '');
$passwordPlain = Minz_Request::param('new_user_passwordPlain', '', true);
+ if (!self::checkUsername($new_user_name)) {
+ Minz_Request::bad(
+ _t('user.username.invalid'),
+ array('c' => 'auth', 'a' => 'register')
+ );
+ }
+
+ if (FreshRSS_UserDAO::exists($new_user_name)) {
+ Minz_Request::bad(
+ _t('user.username.taken', $new_user_name),
+ array('c' => 'auth', 'a' => 'register')
+ );
+ }
+
+ if (!FreshRSS_password_Util::check($passwordPlain)) {
+ Minz_Request::bad(
+ _t('user.password.invalid'),
+ array('c' => 'auth', 'a' => 'register')
+ );
+ }
+
$tos_enabled = file_exists(join_path(DATA_PATH, 'tos.html'));
$accept_tos = Minz_Request::param('accept_tos', false);