Skip to content

Commit 033e78e

Browse files
authored
Merge pull request #59289 from nextcloud/fix/sharing-pwd
fix(sharing): show common confirmation on password reset
2 parents 909ff0e + 17c223e commit 033e78e

4 files changed

Lines changed: 19 additions & 18 deletions

File tree

core/src/views/PublicShareAuth.vue

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ import NcPasswordField from '@nextcloud/vue/components/NcPasswordField'
2121
const publicShareAuth = loadState<{
2222
canResendPassword: boolean
2323
shareType: ShareType
24-
identityOk?: boolean | null
24+
showPasswordReset?: boolean
2525
invalidPassword?: boolean
2626
}>('core', 'publicShareAuth')
2727
2828
const requestToken = getRequestToken()
2929
const sharingToken = getSharingToken()
3030
const { shareType, invalidPassword, canResendPassword } = publicShareAuth
3131
32-
const hasIdentityCheck = typeof publicShareAuth.identityOk === 'boolean'
33-
const showIdentityCheck = ref(typeof publicShareAuth.identityOk === 'boolean')
32+
const isPasswordResetProcessed = !!publicShareAuth.showPasswordReset
33+
const showPasswordReset = ref(publicShareAuth.showPasswordReset ?? false)
3434
const password = ref('')
3535
const email = ref('')
3636
@@ -48,7 +48,7 @@ onMounted(() => {
4848
<NcGuestContent :class="$style.publicShareAuth">
4949
<h2>{{ t('core', 'This share is password-protected') }}</h2>
5050
<form
51-
v-show="!showIdentityCheck"
51+
v-show="!showPasswordReset"
5252
:class="$style.publicShareAuth__form"
5353
method="POST">
5454
<NcNoteCard v-if="invalidPassword" type="error">
@@ -74,15 +74,14 @@ onMounted(() => {
7474
</form>
7575

7676
<form
77-
v-if="showIdentityCheck"
77+
v-if="showPasswordReset"
7878
:class="$style.publicShareAuth__form"
7979
method="POST">
80-
<NcNoteCard v-if="!hasIdentityCheck" type="info">
81-
{{ t('core', 'Please type in your email address to request a temporary password') }}
82-
</NcNoteCard>
83-
84-
<NcNoteCard v-else :type="publicShareAuth.identityOk ? 'success' : 'error'">
85-
{{ publicShareAuth.identityOk ? t('core', 'Password sent!') : t('core', 'You are not authorized to request a password for this share') }}
80+
<NcNoteCard type="info">
81+
{{ isPasswordResetProcessed
82+
? t('core', 'If the email address was correct then you will receive an email with the password.')
83+
: t('core', 'Please type in your email address to request a temporary password')
84+
}}
8685
</NcNoteCard>
8786

8887
<NcTextField
@@ -96,7 +95,7 @@ onMounted(() => {
9695
<input type="hidden" name="passwordRequest" value="">
9796

9897
<NcFormBox row>
99-
<NcButton wide @click="showIdentityCheck = false">
98+
<NcButton wide @click="showPasswordReset = false">
10099
{{ t('core', 'Back') }}
101100
</NcButton>
102101
<NcButton type="submit" variant="primary" wide>
@@ -107,10 +106,10 @@ onMounted(() => {
107106

108107
<!-- request password button -->
109108
<NcButton
110-
v-if="canResendPassword && !showIdentityCheck"
109+
v-if="canResendPassword && !showPasswordReset"
111110
:class="$style.publicShareAuth__forgotPasswordButton"
112111
wide
113-
@click="showIdentityCheck = true">
112+
@click="showPasswordReset = true">
114113
{{ t('core', 'Forgot password') }}
115114
</NcButton>
116115
</NcGuestContent>

core/templates/publicshareauth.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@
99
\OCP\Util::addStyle('core', 'guest');
1010
\OCP\Util::addScript('core', 'public_share_auth');
1111

12+
$showPasswordReset = isset($_['identityOk']) && $_['identityOk'] !== null;
1213
$initialState = \OCP\Server::get(\OCP\IInitialStateService::class);
1314
$initialState->provideInitialState('files_sharing', 'sharingToken', $_['share']->getToken());
1415
$initialState->provideInitialState('core', 'publicShareAuth', [
15-
'identityOk' => $_['identityOk'] ?? null,
16+
// if the password reset was processed (not caring about result)
17+
'showPasswordReset' => $showPasswordReset,
1618
'shareType' => $_['share']->getShareType(),
1719
'invalidPassword' => $_['wrongpw'] ?? null,
1820
'canResendPassword' => $_['share']->getShareType() === \OCP\Share\IShare::TYPE_EMAIL && !$_['share']->getSendPasswordByTalk(),

dist/core-public_share_auth.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/core-public_share_auth.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)