diff --git a/src/Controllers/UserController.php b/src/Controllers/UserController.php index 6cd74ca..542be5e 100644 --- a/src/Controllers/UserController.php +++ b/src/Controllers/UserController.php @@ -232,14 +232,12 @@ public function usersEditDo($id = null) // $emailChange = true; if ($this->request->getPost('email') == $user->email) { - $rules['email'] = 'required|valid_email'; $emailChange = false; } $usernameChange = true; if ($this->request->getPost('username') == $user->username) { - $rules['username'] = 'required|alpha_numeric_space|min_length[3]|max_length[30]'; $usernameChange = false; } @@ -313,6 +311,13 @@ public function usersEditDo($id = null) else $user->setAttribute('active', 0); $users->update($id, $user); + // + // Get the Banned switch. + // + if ($this->request->getPost('swi_banned')) $user->setAttribute('status', 'banned'); + else $user->setAttribute('banned', 0); + $users->update($id, $user); + // // Handle the Groups tab // diff --git a/src/Helpers/bs5_helper.php b/src/Helpers/bs5_helper.php index 68c4e22..6d660ec 100644 --- a/src/Helpers/bs5_helper.php +++ b/src/Helpers/bs5_helper.php @@ -285,7 +285,16 @@ function bs5_formrow($data) ' . $data['desc'] . '
- +
' . $data['errors'] . '
@@ -306,7 +315,17 @@ function bs5_formrow($data)
- +
+ +
' . $data['errors'] . '
' . $data['errors'] . '
diff --git a/src/Language/de/Auth.php b/src/Language/de/Auth.php index 010b1bb..4a3d0ac 100644 --- a/src/Language/de/Auth.php +++ b/src/Language/de/Auth.php @@ -17,6 +17,15 @@ 'warning' => 'Warnung', ], + // + // Account + // + 'account' => [ + 'active' => 'Konto aktiv', + 'banned' => 'Konto gebannt', + 'inactive' => 'Konto nicht aktiv', + ], + // // Activation // @@ -250,6 +259,8 @@ 'user' => [ 'active' => 'Aktiv', 'active_desc' => 'Aktiviere oder deaktiviere diesen Nutzer.', + 'banned' => 'Gebannt', + 'banned_desc' => 'Banne oder unbanne diesen Nutzer.', 'create_success' => 'Neuer Benutzer anegelegt: {0} ({1})', 'delete_confirm' => 'Bist du sicher, dass du diesen Benutzer löschen willst?', 'delete_success' => 'Benutzer gelöscht: {0}', diff --git a/src/Language/en/Auth.php b/src/Language/en/Auth.php index 02ccfc9..5573ad3 100644 --- a/src/Language/en/Auth.php +++ b/src/Language/en/Auth.php @@ -17,6 +17,15 @@ 'warning' => 'Warning', ], + // + // Account + // + 'account' => [ + 'active' => 'Account active', + 'banned' => 'Account banned', + 'inactive' => 'Account not active', + ], + // // Activation // @@ -250,6 +259,8 @@ 'user' => [ 'active' => 'Active', 'active_desc' => 'Activate or deactivate this user.', + 'banned' => 'Banned', + 'banned_desc' => 'Ban or unban this user.', 'create_success' => 'New user created: {0} ({1})', 'delete_confirm' => 'Are you sure you want to delete this user?', 'delete_success' => 'User deleted: {0} ({1})', diff --git a/src/Language/es/Auth.php b/src/Language/es/Auth.php index 7a471ef..9e97a60 100644 --- a/src/Language/es/Auth.php +++ b/src/Language/es/Auth.php @@ -17,6 +17,15 @@ 'warning' => 'Aviso', ], + // + // Account + // + 'account' => [ + 'active' => 'Cuenta activa', + 'banned' => 'Cuenta prohibida', + 'inactive' => 'Cuenta no activa', + ], + // // Activation // @@ -250,6 +259,8 @@ 'user' => [ 'active' => 'Activo', 'active_desc' => 'Activado o desactivado el usario.', + 'banned' => 'Proscrito', + 'banned_desc' => 'Prohibir o anular la prohibición de este usuario.', 'create_success' => 'Nuevo usuario creado: {0} ({1})', 'delete_confirm' => '¿Seguro que quieres borrar este usuario?', 'delete_success' => 'Usuario borrado: {0} ({1})', diff --git a/src/Views/_footer.php b/src/Views/_footer.php index 6f3095b..ef6c0c4 100644 --- a/src/Views/_footer.php +++ b/src/Views/_footer.php @@ -2,14 +2,18 @@ - diff --git a/src/Views/_header.php b/src/Views/_header.php index 7e85ee3..faaea91 100644 --- a/src/Views/_header.php +++ b/src/Views/_header.php @@ -38,6 +38,21 @@ text-align: center; width: 20px; } + .tooltip-danger { + --bs-tooltip-bg: var(--bs-danger); + } + .tooltip-info { + --bs-tooltip-bg: var(--bs-info); + } + .tooltip-primary { + --bs-tooltip-bg: var(--bs-primary); + } + .tooltip-success { + --bs-tooltip-bg: var(--bs-success); + } + .tooltip-warning { + --bs-tooltip-bg: var(--bs-warning); + } diff --git a/src/Views/users/edit.php b/src/Views/users/edit.php index a975184..1cdb05f 100644 --- a/src/Views/users/edit.php +++ b/src/Views/users/edit.php @@ -117,7 +117,19 @@ 'title' => lang('Auth.user.active'), 'desc' => lang('Auth.user.active_desc'), 'errors' => session('errors.active'), - 'value' => $user->active + 'value' => $user->active, + 'disabled' => ($user->id==1) ? true : false + ]); + + echo bs5_formrow([ + 'type' => 'switch', + 'mandatory' => false, + 'name' => 'banned', + 'title' => lang('Auth.user.banned'), + 'desc' => lang('Auth.user.banned_desc'), + 'errors' => session('errors.banned'), + 'value' => $user->banned, + 'disabled' => ($user->id==1) ? true : false ]); ?> diff --git a/src/Views/users/list.php b/src/Views/users/list.php index 838dc3e..7ae2d1d 100644 --- a/src/Views/users/list.php +++ b/src/Views/users/list.php @@ -39,7 +39,11 @@
- + getGroups(); + $userRoles = $user->getRoles(); + ?>
@@ -49,9 +53,25 @@
username ?>
email ?>
-
...
-
...
-
...
+
+ '; + endforeach; ?> +
+
+ '; + endforeach; ?> +
+
+ isActivated() ? + '' : + '' + ?> + isBanned() ? + '' : '' + ?> +