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

Allow enforcing share passwords only when already asking for a password #38227

Conversation

danxuliu
Copy link
Member

In admin Sharing settings, Enforce password protection is a subcase of Always ask for a password, so it should be:

  • Indented a bit
  • Disabled if Always ask for a password is not checked

Note that in the Sharing settings other dependant options are fully hidden rather than just disabled when their parent is unchecked. However, existing instances could have Enforce password protection checked and Always ask for a password unchecked, so if admins are not aware of this change it could be confusing for them if Enforce password protection is fully gone after updating Nextcloud to the next version.

Alternatively (or in addition) some kind of migration could be applied to automatically enable Always ask for a password if Enforce password protection was checked, but I was not sure where or how to add it.

Besides that change the markup was fixed, as showing Exclude groups from password requirements caused Set default expiration date to be wrongly indented (apparently due to using a div inside a p, which is not allowed, as only phrasing content should be used in paragraphs).

🖼️ Screenshots

🏚️ Before 🏡 After
Settings-Sharing-Enforce-Password-Protection-Before Settings-Sharing-Enforce-Password-Protection-After

How to test (scenario 1)

  • Set sharing.allow_disabled_password_enforcement_groups => true, in config/config.php
  • Open the admin Sharing settings
  • Enable Enforce password protection

Result with this pull request

Set default expiration date is properly indented

Result without this pull request

Set default expiration date has no indentation and appears as a sibling of Allow users to share via link and emails instead of a child

How to test (scenario 2)

  • Open the admin Sharing settings
  • Enable and disable Always ask for a password

Result with this pull request

Enforce password protection is enabled when Always ask for a password is checked, and disabled when it is not

Result without this pull request

Enforce password protection does not change

@danxuliu danxuliu added this to the Nextcloud 27 milestone May 12, 2023
@danxuliu danxuliu requested review from jancborchardt, Pytal, a team, susnux and nfebe and removed request for a team May 12, 2023 16:57
Copy link
Member

@jancborchardt jancborchardt left a comment

Choose a reason for hiding this comment

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

Seems ok design-wise! We don't use new components here yet though, right? Looks a bit cramped – but separate topic.

@blizzz blizzz mentioned this pull request May 17, 2023
@szaimen
Copy link
Contributor

szaimen commented May 19, 2023

So rebase and then merge?

danxuliu and others added 7 commits May 22, 2023 12:44
Signed-off-by: Daniel Calviño Sánchez <[email protected]>
The rest of "<br/>" elements in the file appear immediately after their
previous "</label>" rather than in a new line.

Signed-off-by: Daniel Calviño Sánchez <[email protected]>
The permitted contents of a paragraph are only phrasing contents, so
"div" elements can not be used, although "span" can. Besides being
invalid HTML it seems that the browser ends the paragraph at the div, so
the label/input that appears after it is treated as being in a new
paragraph, which is not indented by default, and thus is not aligned
with the rest of its sibling inputs.

Note that an additional div is nevertheless added once the page is
loaded to be able to select the groups, but this one does not break its
parent paragraph (maybe due to being added after the page load, but I do
not really know). Nevertheless, it needs to be explicitly indented, and
the second indentend wrapper needs to be removed, as it affects only the
label but not the div/input, and therefore the label had an extra
indentation over the input.

Signed-off-by: Daniel Calviño Sánchez <[email protected]>
"Enforce password protection" is a subcase of "Always ask for a
password", so it should be indented to visually show the dependency.

Signed-off-by: Daniel Calviño Sánchez <[email protected]>
Signed-off-by: Daniel Calviño Sánchez <[email protected]>
"Enforce password protection" is a subcase of "Always ask for a
password", so it should be disabled if its parent option is unchecked.
Although other dependant options in the sharing settings are fully
hidden instead of just disabled this option is disabled but shown to
avoid confusion when updating from a previous Nextcloud version where
"Always ask for a password" was unchecked and "Enforce password
protection" was checked.

Besides that, due to their dependency the enforced password protection
is now automatically unchecked too if its parent option is unchecked.

Finally, the groups excluded from password requirements are also
disabled when "Always ask for a password" is unchecked, as they might be
still shown if "Enforce password protection" was checked due to an
update from a previous version.

Signed-off-by: Daniel Calviño Sánchez <[email protected]>
Signed-off-by: Joas Schilling <[email protected]>
@nickvergessen nickvergessen force-pushed the allow-enforcing-share-passwords-only-when-already-asking-for-a-password branch from caf03b5 to c1f3bcf Compare May 22, 2023 10:47
@nickvergessen nickvergessen enabled auto-merge May 22, 2023 10:47
@nickvergessen nickvergessen merged commit fdf7fd4 into master May 22, 2023
@nickvergessen nickvergessen deleted the allow-enforcing-share-passwords-only-when-already-asking-for-a-password branch May 22, 2023 12:06
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.

5 participants