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

Adjust settings for mail link password #31975

Merged

Conversation

PVince81
Copy link
Member

Rename the settings and invert the meaning.
Increase default interval to one hour.
Changed the interval to be a number of seconds, to align with other
setting styles.

as discussed with @jancborchardt

@PVince81 PVince81 added the 3. to review Waiting for reviews label Apr 14, 2022
@PVince81 PVince81 self-assigned this Apr 14, 2022
Rename the settings and invert the meaning.
Increase default interval to one hour.
Changed the interval to be a number of seconds, to align with other
setting styles.

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
@PVince81 PVince81 force-pushed the bugfix/31952/fix-mail-link-share-password-expiration-settings branch from 9da4e23 to 82f1344 Compare April 14, 2022 12:15
Copy link
Member

@blizzz blizzz left a comment

Choose a reason for hiding this comment

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

good, only no milestone set

@PVince81 PVince81 added this to the Nextcloud 24 milestone Apr 14, 2022
Comment on lines +1185 to +1188
$now = new \DateTime();
$expirationInterval = $this->config->getSystemValue('sharing.mail_link_password_expiration_interval', 3600);
$expirationTime = $now->add(new \DateInterval('PT' . $expirationInterval . 'S'));
$share->setPasswordExpirationTime($expirationTime);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
$now = new \DateTime();
$expirationInterval = $this->config->getSystemValue('sharing.mail_link_password_expiration_interval', 3600);
$expirationTime = $now->add(new \DateInterval('PT' . $expirationInterval . 'S'));
$share->setPasswordExpirationTime($expirationTime);
$expirationTime = new \DateTime();
$expirationInterval = $this->config->getSystemValue('sharing.mail_link_password_expiration_interval', 3600);
$expirationTime->add(new \DateInterval('PT' . $expirationInterval . 'S'));
$share->setPasswordExpirationTime($expirationTime);

}
$now = new \DateTime();
$expirationInterval = $this->config->getSystemValue('sharing.mail_link_password_expiration_interval', 3600);
$expirationTime = $now->add(new \DateInterval('PT' . $expirationInterval . 'S'));
Copy link
Member

Choose a reason for hiding this comment

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

A try catch with a error log would make sense in case the admin did a mistake when configuration the interval (e,g, put a broken value or negative number)

Copy link
Member Author

Choose a reason for hiding this comment

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

I just removed the try catch because I didn't think such easy mistake could be done

the try-catch before was because of the complex interval string where a mistake is much more likely

@blizzz blizzz added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Apr 14, 2022
@PVince81
Copy link
Member Author

failure unrelated, merging

@PVince81 PVince81 merged commit 396db12 into master Apr 14, 2022
@PVince81 PVince81 deleted the bugfix/31952/fix-mail-link-share-password-expiration-settings branch April 14, 2022 15:51
@blizzz blizzz mentioned this pull request Apr 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4. to release Ready to be released and/or waiting for tests to finish
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants