diff options
author | Cyrille Bollu <cyrpub@bollu.be> | 2022-02-05 20:49:17 +0100 |
---|---|---|
committer | Cyrille Bollu <cyrpub@bollu.be> | 2022-04-11 21:58:24 +0200 |
commit | c6a5c07041d2e5d20771409aede8b755d28372ac (patch) | |
tree | 71051efd25c16bed5a419eb1670477f1f5471933 /lib/public/AppFramework | |
parent | 60f946aba5862102a81100b09e26b37b6d59a3fa (diff) | |
download | nextcloud-server-c6a5c07041d2e5d20771409aede8b755d28372ac.tar.gz nextcloud-server-c6a5c07041d2e5d20771409aede8b755d28372ac.zip |
Adds a "Request password" button to the public share authentication page for shares
of type TYPE_EMAIL, when the "video verification" checkbox isn't checked. Users accessing
non-anonymous public shares (TYPE_EMAIL shares) can now request a temporary password themselves.
- Creates a migration step for the files_sharing app to add the 'password_expiration_time'
attribute to the oc_shares table.
- Makes share temporary passwords' expiration time configurable via a system value.
- Adds a system config value to allow permanent share passwords
-Fixes a typo in a comment in apps/files_sharing/src/components/SharingEntryLink.vue
See https://github.com/nextcloud/server/issues/31005
Signed-off-by: Cyrille Bollu <cyrpub@bollu.be>
Diffstat (limited to 'lib/public/AppFramework')
-rw-r--r-- | lib/public/AppFramework/AuthPublicShareController.php | 47 |
1 files changed, 44 insertions, 3 deletions
diff --git a/lib/public/AppFramework/AuthPublicShareController.php b/lib/public/AppFramework/AuthPublicShareController.php index 33adf7b5fe4..bd0e32f566d 100644 --- a/lib/public/AppFramework/AuthPublicShareController.php +++ b/lib/public/AppFramework/AuthPublicShareController.php @@ -85,11 +85,39 @@ abstract class AuthPublicShareController extends PublicShareController { } /** + * The template to show after user identification + * + * @since 24.0.0 + */ + protected function showIdentificationResult(bool $success): TemplateResponse { + return new TemplateResponse('core', 'publicshareauth', ['identityOk' => $success], 'guest'); + } + + /** + * Validates that the provided identity is allowed to receive a temporary password + * + * @since 24.0.0 + */ + protected function validateIdentity(?string $identityToken = null): bool { + return false; + } + + /** + * Generates a password + * + * @since 24.0.0 + */ + protected function generatePassword(): void { + } + + /** * Verify the password * - * @since 14.0.0 + * @since 24.0.0 */ - abstract protected function verifyPassword(string $password): bool; + protected function verifyPassword(string $password): bool { + return false; + } /** * Function called after failed authentication @@ -120,12 +148,25 @@ abstract class AuthPublicShareController extends PublicShareController { * * @since 14.0.0 */ - final public function authenticate(string $password = '') { + final public function authenticate(string $password = '', string $passwordRequest = 'no', string $identityToken = '') { // Already authenticated if ($this->isAuthenticated()) { return $this->getRedirect(); } + // Is user requesting a temporary password? + if ($passwordRequest == '') { + if ($this->validateIdentity($identityToken)) { + $this->generatePassword(); + $response = $this->showIdentificationResult(true); + return $response; + } else { + $response = $this->showIdentificationResult(false); + $response->throttle(); + return $response; + } + } + if (!$this->verifyPassword($password)) { $this->authFailed(); $response = $this->showAuthFailed(); |