Commit graph

80 commits

Author SHA1 Message Date
Viktor Szépe
5ff1ec08a0
Fix typos throughout codebase (#23813)
Several typos and common misspellings of words exists throughout Cockpit. This fixes the spellings.
2026-10-14 14:02:30 +02:00
Jelle van der Waa
3834a50f25 pkg: Fix typos discovered by codespell 2026-08-18 11:58:12 +02:00
Jelle van der Waa
62079ac213 users: validate that the real name does not contain a colon
We already validate the real name when creating a new user but not when
editing an existing user.
2026-05-12 13:41:06 +02:00
Marius Vollmer
e74fdfe0b0 users: Don't rely on chage to recognize "99999" max days as "never".
It has stopped doing that in Fedora 44 and elsewhere.

The documented value for "never" is -1, and we recognize this now as
well.  We also use "passwd -x -1" when setting password expiry to
"never".
2026-04-23 10:29:02 +02:00
Martin Pitt
a7ae147258 REUSE: Convert license headers to SPDX format
Replace full LGPL/GPL/MIT/BSD license header with
SPDX-License-Identifier in all source files. This is more concise and
makes the license information machine readable.

Keep the full text of ISC for src/common/cockpitbase64.[hc], it's small
enough and only used in this pair of files. Also keep the CC-BY-SA
paragraph in pkg/storaged/icons/gnome-icons.jsx as explained in the
previous commit.

See https://reuse.software/spec-2.0/#2-include-a-copyright-notice-and-license-in-each-file

https://issues.redhat.com/browse/COCKPIT-1742
2026-02-04 10:24:11 +01:00
Freya Gustavsson
1466b97f41 css: Move no-masthead-sidebar to pf-m-sidebar
This is the official class for it so we no longer need our own
workaround.

Related-to: https://github.com/patternfly/patternfly/issues/7357
Signed-off-by: Freya Gustavsson <freya@venefilyn.se>
2025-10-15 09:50:01 +02:00
Freya Gustavsson
b006ebe0a6 users: Fix double-rendering of user fields
Within user details there was an issue where if you modify something
like "Disallow interactive password" you would get two renders following
the information from cockpit. First render didn't change the state at
all whereas the second render did. However, if the second render is a
bit slower enough this would cause visual rendering changes that look
very jarring.

To help with tests, an OUIA Ready flag has been added to the checkbox
to signify that the checkbox is not waiting for anything.

Splits out the Account not found return from AccountDetails as it
did not fit in the scope and increased complexity of the component as
the account parameter shouldn't be undefined for AccountDetails.

Fixes: https://github.com/cockpit-project/cockpit/issues/21862
Signed-off-by: Freya Gustavsson <freya@venefilyn.se>
2025-09-02 08:00:04 +02:00
Freya Gustavsson
5847d91cc1 users: Refactor snakecase to camelCase
Variables in JS should be `camelCase`, especially when it comes to
consistency.

Signed-off-by: Freya Gustavsson <freya@venefilyn.se>
2025-09-02 08:00:04 +02:00
Divyanshu Gupta
2c8c6a84a1
users: allow fullname to be set as empty string (#21667)
* allow fullname to be set as empty string

* implemented strict comparison
2025-05-20 16:25:47 +02:00
Freya Gustavsson
8db6565337 lib: Update to Patternfly v6
Huge team-effort to redesign Cockpit with Patternfly v6 in mind and to
reduce the amount of hacks and legacy code we have. This also paves the
way to further improve Patternfly itself by keeping up-to-date with
their latest releases.

Commit includes codemod changes, updated tests, improved layout for
desktop and mobile, as well as inline-comments here and there for what
we need to fix.

Co-authored-by: Garrett LeSage <garrett@redhat.com>
Co-authored-by: Tomas Matus <tomatus777@gmail.com>
Co-authored-by: Martin Pitt <mpitt@redhat.com>
Relates-to: #21651, #20973

https://issues.redhat.com/browse/COCKPIT-1266
2025-03-24 12:12:46 +01:00
Jelle van der Waa
2a76830f7c users: Remove useless React fragment 2025-03-10 07:02:50 +01:00
Jelle van der Waa
1cc67cefe3 users: disable deleting/logging out current logged in account
For the current logged in user, Cockpit already has a logout button to
cleanly log out a user. Deleting the current user is neither user
friendly and nothing we accidentally want a user to do.
2025-02-05 14:00:25 +01:00
Marius Vollmer
01e4afe72d users: Use MultiTypeaheadSelect instead of deprecated Select variant 2024-12-03 15:50:28 +01:00
Martin Pitt
c016cf302e all: Move gnu.org/license URLs to https://
To skip the automatic redirect.

This was done mechanically with:
```sh
git grep -l http://www.gnu.org/licenses/ | xargs sed  -i 's@http://www.gnu.org@https://www.gnu.org@g'
```
2024-08-19 09:23:02 +02:00
Martin Pitt
83e0f531d6 pkg: Drop extension in timeformat imports
We are about to rename it to *.ts.
2024-06-26 10:55:41 +02:00
Martin Pitt
e6dd518a4f users: Clean up expiry effect in AccountDetails
We don't need to duplicate all the utmp watching machinery there. The
parent in users.js already does that, and whenever there's an utmp
change (login or logout), the affected users's `loggedIn` property
changes, which triggers a re-render of AccountDetails and re-running the
effect.

Note: it's also a bit silly to trigger this on login/logout changes --
this should only be triggered on changing /etc/shadow (which happens
less often, and it also happens independently of login changes). But now
at least it happens just once, not twice.
2024-05-23 16:39:59 +02:00
Luna
6bf8d112f5 users: Support for watching lastlog2 and wutmp on overview page 2024-05-22 14:25:15 +03:00
Luna
93d0a6d4db
users: Support for watching lastlog2 2024-05-03 08:26:22 +02:00
Marius Vollmer
258ca0306f users: Disable "locked" checkbox when no info is available
Fixes: #19822
2024-03-05 06:00:48 +01:00
Jelle van der Waa
2682ba9b09 users: circumvent inconsistent loading state
When a group is removed by clicking on the LabelGroups, we set `loading`
true to circumvent the dropdown menu to be opened and showing an
inconsistent state. However useEffect can also influence the state of
`loading` which leads to a race in testGroups, where removing a group,
then clicking on the menu and waiting for it to open can close it
unexpectedly as useEffect resets `loading` and more importantly addGroup
never set `loading` to false after it was finished.

By decoupling the state of addGroup/removeGroup into it's own state we
should get a consistent behaviour of disabling the Select menu and no
flaky tests.
2024-03-01 19:35:27 +01:00
Jelle van der Waa
e54b8dc1ed users: drop unused setError
setError is not even passed to AccountDetails
2024-03-01 19:35:27 +01:00
Jelle van der Waa
5c06dbe40d users: don't fsread1 on file changes for /var/run/utmp
We don't do anything with the content of /var/run/utmp so the file does
not have to be read on file updates.
2024-02-08 21:18:42 +01:00
Martin Pitt
3d5b359c4f users: Move get_locked() into a new utils.js
We are going to use it from the main accounts page as well.
2023-12-18 12:16:53 +01:00
Martin Pitt
8345473fae users: Sort imports
Split them into the usual "third party" - "our lib" - "page local"
categories.
2023-12-18 12:16:53 +01:00
Martin Pitt
c843501515 users: Correct bz#853153 documentation
That bug is still alive and well after 11 years, so stop claiming it is
fixed.
2023-12-18 12:16:53 +01:00
Martin Pitt
1a1ef78dd9 users: Drop unused shadow property from AccountDetails 2023-12-18 12:16:53 +01:00
Jelle van der Waa
0609c8703f users: allow administrators to change the user shell
On Fedora a normal user can change it's own shell only through `lchsh`
while other distributions do package `chsh` a setuid binary. As a
compromise allow changing of the shell only for the Administrator and
use `usermod` for changing the users shell which should be available on
all supported systems by default.
2023-07-24 18:21:16 +02:00
mukesh kumar
9273b3a688
all: Replace onKeyPress with onKeyDown
`onKeyPress` is deprecated:
https://developer.mozilla.org/en-US/docs/Web/API/Element/keypress_event
2023-07-17 07:18:27 +02:00
Katerina Koukiou
2e70ca3ceb all: adjust parameter position for the onChange callback of the TextInput 2023-05-20 22:06:49 +02:00
Katerina Koukiou
a818e5f406 all: LabelGroup changed import path 2023-05-20 22:06:49 +02:00
Katerina Koukiou
14174cf6f6 Update all selectors, [s]css vars to include v5
https://github.com/patternfly/patternfly/issues/5376

I don't really see through this change therefore I asked here:
https://github.com/patternfly/patternfly/issues/5376
2023-05-20 22:06:49 +02:00
Garrett LeSage
d0af7b9442 all: Manually fix usage of logical properties for spacing based on stylelint errors 2023-05-11 18:39:09 +02:00
Katerina Koukiou
4770704536
all: Use <CardTitle component="h2"... for cards 2023-05-03 11:31:20 +02:00
Katerina Koukiou
fc359dc2a5 Update to patternfly 5 alpha
Most notable code changes:

* Dropdowns and selects are being temporarily imported from the
deprecated path
* callbacks from many componenents changed argument order so that events
are the first arg
* CardActions are now moved into 'actions' property of the CardHeader
* SelectVariant should be now used as string
* Remove isSvg property from Spinner component
* Replace isSmall, isLarge properties in buttons with size=["sm", "lg"]

Adjust tests to expect the PF5 changes on dom structure.
Also update pixel tests.
2023-04-27 10:01:08 +02:00
Katerina Koukiou
1dd0d07151
Adjust Breadcrumb usage on all affected pages to match PF5 guidelines
This is still PF4 compatible.

The only noticeable change is on firewall, as now only the breadcrumbs will remain sticky and the
rest of the page headers will hide on scroll. This is the desired
behavior as suggested here [0]

Patternfly overrides were also updated to reflect the new DOM layout.

[0] https://github.com/cockpit-project/cockpit/pull/18476#pullrequestreview-1343830115
2023-04-21 14:39:09 +02:00
Katerina Koukiou
5648586f0a
Port to new way of using HelperText
FormGroup in PF5 abandonded the validated and helperText* properties. To
make porting easier start using these as PF5 requires.
2023-04-17 11:51:34 +02:00
Caleb Durojaiye
f6dc34aeab users: fix text misalignment issue in account overview menu 2023-03-22 14:48:34 +01:00
Simon Kobyda
9dd76714b7 users: Show shell and home directory in user's details page 2023-03-17 06:12:34 +01:00
Ahmed Abdelatty
5ede6e2c55
lib & users: use optional chaining when possible 2023-03-12 18:46:14 +01:00
Katerina Koukiou
a54ebb9488 users: don't use hardcoded command paths in cockpit.spawn 2023-03-01 14:57:29 +01:00
Katerina Koukiou
097f93cfe1 Bump eslint version
Autofix warnings: Expected property shorthand
2023-02-27 23:53:02 +01:00
Katerina Koukiou
cfde666c56 Use whole path in patternfly imports
Otherwise we rely on treeshaking mechanisms to remove unused code, thus
making our bundle size more vulnerable to bundler's ability to drop dead
code.
2023-02-23 12:33:06 +01:00
Katerina Koukiou
d7a010ebe1 users: don't propagate the event when clicking on the close button on groups
The even was picked up by the selector input and it was opening the
menu for a fraction of a second.
2023-02-09 18:52:46 +01:00
Katerina Koukiou
0dfad9169f test: users: update the group selection UI only when the configuration get's propagated from the backend
Till then disable the selector.
2023-02-09 18:52:46 +01:00
Katerina Koukiou
8fe7d23962 all: eliminate ct-pagesection-mobile class
This class removes side padding in mobile view for the page section
component. This is a clear patternfly override and should be treated as
such, by being placed in the patternfly-overrides file.
2022-12-20 14:40:12 +01:00
Katerina Koukiou
d196dd2636 users: only use gpasswd for editing groups 2022-12-14 15:27:48 +01:00
Katerina Koukiou
c9603b33af users: added undo button for groups changes 2022-12-14 15:27:48 +01:00
Katerina Koukiou
44777ab398 user: add support for group editing in the user details
This drops the account roles component.
2022-12-14 15:27:48 +01:00
Matej Marusak
abe017ae0e users: Show loading state
Current implementation would show blank page and wait until everything
was loaded. Now the overview is shown with loading state inside groups
and users views. Details page shows big spinner.
2022-12-12 18:49:16 +01:00
Jelle van der Waa
d60a45aa49 containers: pkg: drop superfluous trailing argument 2022-12-12 17:37:07 +01:00