Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wizard: add user information step (HMS-4903) #2551

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

mgold1234
Copy link
Collaborator

@mgold1234 mgold1234 commented Nov 3, 2024

wizard: add user information step (HMS-4903)
This commit introduces the user information step with the following fields:
() userName field with validation according to Red Hat guidelines: https://access.redhat.com/solutions/30164
(
) password field with validation using the pam_pwquality module, which enforces strict password policies for Linux systems.
This module enhances security by enforcing minimum length, complexity, and avoiding weak passwords.
More info: https://access.redhat.com/solutions/6979714
Validation is configured based on the requirements defined for our systems:
https://github.com/osbuild/osbuild-composer/tree/main/test/data/manifests
https://github.com/osbuild/images/pkg/distro/rhel/rhel10
() confirm password field that check if confirm password equal to password
(
) ssh key field - implement the same validation as we have in edge.
[x] [wip> unit tests- in progress because I want to make sure that all new fields are in a good shape.
Screenshot 2024-11-12 at 12 42 25

@mgold1234 mgold1234 marked this pull request as draft November 3, 2024 20:20
@lucasgarfield lucasgarfield changed the title <WIP> User info <WIP> User info (HMS-4903) Nov 4, 2024
@mgold1234 mgold1234 force-pushed the user_info branch 27 times, most recently from 0d89bee to fe5208c Compare November 12, 2024 10:30
@avitova
Copy link
Contributor

avitova commented Nov 21, 2024

There is a bug now - if you fill in the user information, click next, visit the Users step again, and change some of the fields, all of the contents of the other fields get deleted.

Screencast.From.2024-11-21.17-44-57.mp4

Other than that, it looks good, I think. :)

@avitova
Copy link
Contributor

avitova commented Nov 26, 2024

There is a bug now - if you fill in the user information, click next, visit the Users step again, and change some of the fields, all of the contents of the other fields get deleted.

Screencast.From.2024-11-21.17-44-57.mp4
Other than that, it looks good, I think. :)

This still happens in case that I:

  1. Fill in the user info.
  2. Go to the next steps.
  3. Return back, and try to change any of the fields.

Copy link
Collaborator

@regexowl regexowl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some questions, the step is looking really good ✨

src/test/fixtures/editMode.ts Outdated Show resolved Hide resolved
<FormHelperText>
<HelperText>
<HelperTextItem>
Can contain at least 3 different character classes (uppercase
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we require three different character classes, I'd change the wording a bit.

Suggested change
Can contain at least 3 different character classes (uppercase
Must contain at least 3 different character classes (uppercase

if (additionalLogic) {
additionalLogic(updatedUser);
}
// Determine if user exists by index, not name
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not name? Shouldn't the user name be unique? 🤔

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think keeping track of the user via an id makes sense to me.

Imagine an edge case where you have a user called user. Then you want to add a second user, user2. As you are typing in user2, there will be a brief moment in time where you have two users with the same name (user).

We will still want to enforce uniqueness in the validation, of course, but using an id to keep track of the users would help us avoid problems like the one above.

return (
<EmptyState variant={EmptyStateVariant.lg}>
<EmptyStateHeader
icon={<EmptyStateIcon icon={UserIcon} />}
headingLevel="h4"
/>
<EmptyStateFooter>
<Button variant="secondary" onClick={() => {}}>
<Button variant="secondary" onClick={onAddUserClick}>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switching between the empty and user creation states could be handled in a similar way like FSC I think, we could introduce a helper into the users structure called userMode or smth like that and then switch what renders on the step based on a store value.

But this might also be a follow up.

Comment on lines +98 to +101
userState: {
users: UserWithAdditionalInfo[];
userInfo: UserWithAdditionalInfo;
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What blocks us from doing just:

Suggested change
userState: {
users: UserWithAdditionalInfo[];
userInfo: UserWithAdditionalInfo;
};
users: UserWithAdditionalInfo[];

and accessing the users by their name value?

This way we have a complex structure that includes an array and then just one item of the array that is stored outside of it

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it becomes very complicated to implement the change of every field. and like in this way, the verifaition of every filed stay simple

@mgold1234
Copy link
Collaborator Author

@avitova very strange, it is not happend to me, are you looking into the last commit?

Screen.Recording.2024-11-26.at.12.16.32.mov

@avitova
Copy link
Contributor

avitova commented Nov 26, 2024

@mgold1234 Yes, your are right, then dismiss my comment. You fixed it, I accidentally tested different version.

This commit introduces the user information step with the following fields:
(*) `userName` field with validation according to Red Hat guidelines: https://access.redhat.com/solutions/30164
(*) `password` field with validation using the pam_pwquality module, which enforces strict password policies for Linux systems.
This module enhances security by enforcing minimum length, complexity, and avoiding weak passwords.
  More info: https://access.redhat.com/solutions/6979714
Validation is configured based on the requirements defined for our systems:
  https://github.com/osbuild/osbuild-composer/tree/main/test/data/manifests
  https://github.com/osbuild/images/pkg/distro/rhel/rhel10
(*) `confirm password` field that check if confirm password equal to password
(*) `ssh key` field - implement the same validation as we have in edge.
[x] [wip> unit tests- in progress because I want to make sure that all new fields are in a good shape.
!(
userName === '' &&
userPassword === '' &&
userSshKey === ''
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be either password OR SSH key.

if (additionalLogic) {
additionalLogic(updatedUser);
}
// Determine if user exists by index, not name
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think keeping track of the user via an id makes sense to me.

Imagine an edge case where you have a user called user. Then you want to add a second user, user2. As you are typing in user2, there will be a brief moment in time where you have two users with the same name (user).

We will still want to enforce uniqueness in the validation, of course, but using an id to keep track of the users would help us avoid problems like the one above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants