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

Improve password confirmation dialog #605

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions l10n/messages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@ msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"

msgid "Authentication required"
msgstr ""

msgid "Confirm"
msgstr ""

msgid "Failed to authenticate, please try again"
msgid "Confirm your password"
msgstr ""

msgid "Password"
Expand All @@ -17,5 +14,8 @@ msgstr ""
msgid "Password confirmation dialog already mounted"
msgstr ""

msgid "This action requires you to confirm your password"
msgid "This action needs authentication"
msgstr ""

msgid "Wrong password"
msgstr ""
25 changes: 12 additions & 13 deletions src/components/PasswordDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,14 @@
<NcPasswordField ref="field"
:value.sync="password"
:label="passwordLabelText"
:helper-text="showError ? errorText : ''"
:error="showError"
required
@keydown.enter="confirm" />

<NcNoteCard v-if="showError"
:show-alert="true">
<p>{{ errorText }}</p>
</NcNoteCard>

<NcButton type="primary"
class="dialog__button"
:disabled="!password"
:aria-label="confirmText"
@click="confirm">
{{ confirmText }}
Expand All @@ -57,7 +56,6 @@ import Vue from 'vue'
import axios from '@nextcloud/axios'
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
import NcModal from '@nextcloud/vue/dist/Components/NcModal.js'
import NcNoteCard from '@nextcloud/vue/dist/Components/NcNoteCard.js'
import NcPasswordField from '@nextcloud/vue/dist/Components/NcPasswordField.js'
import { generateUrl } from '@nextcloud/router'
import { DIALOG_ID } from '../globals.js'
Expand All @@ -71,7 +69,6 @@ export default Vue.extend({
components: {
NcButton,
NcModal,
NcNoteCard,
NcPasswordField,
},

Expand All @@ -80,10 +77,10 @@ export default Vue.extend({
password: '',
showError: false,
dialogId: DIALOG_ID,
titleText: t('Authentication required'),
subtitleText: t('This action requires you to confirm your password'),
titleText: t('Confirm your password'),
subtitleText: t('This action needs authentication'),
passwordLabelText: t('Password'),
errorText: t('Failed to authenticate, please try again'),
errorText: t('Wrong password'),
confirmText: t('Confirm'),
}
},
Expand All @@ -100,9 +97,11 @@ export default Vue.extend({

const url = generateUrl('/login/confirm')
try {
const { data } = await axios.post(url, { password: this.password })
window.nc_lastLogin = data.lastLogin
this.$emit('confirmed')
if (this.password !== '') {
artonge marked this conversation as resolved.
Show resolved Hide resolved
const { data } = await axios.post(url, { password: this.password })
window.nc_lastLogin = data.lastLogin
this.$emit('confirmed')
}
} catch (e) {
this.showError = true
}
Expand Down
Loading