Skip to content
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
179 changes: 83 additions & 96 deletions resources/js/components/SessionExpiry.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,129 +2,116 @@
<div class="session-expiry">
<button v-if="isWarning" class="session-expiry-stripe" @click="extend" v-text="warningText" />

<modal name="session-timeout-login" v-if="isShowingLogin" height="auto" :width="500">
<div class="-max-h-screen-px">
<div
class="flex items-center justify-between rounded-t-lg border-b bg-gray-200 px-5 py-3 text-lg font-semibold dark:border-dark-900 dark:bg-dark-550"
>
{{ __('Resume Your Session') }}
</div>

<div v-if="isUsingOauth" class="p-5">
<a :href="oauthProvider.loginUrl" target="_blank" class="btn-primary">
{{ __('Log in with :provider', { provider: oauthProvider.label }) }}
</a>
<div class="mt-4 text-2xs text-gray">
{{ __('messages.session_expiry_new_window') }}
</div>
<Modal :title="__('Resume Your Session')" :open="isShowingLogin" height="auto" :width="500">
<div v-if="isUsingOauth" class="p-5">
<a :href="oauthProvider.loginUrl" target="_blank" class="btn-primary">
{{ __('Log in with :provider', { provider: oauthProvider.label }) }}
</a>
<div class="mt-4 text-2xs text-gray">
{{ __('messages.session_expiry_new_window') }}
</div>
</div>

<div v-if="!isUsingOauth" class="publish-fields p-2">
<div class="form-group w-full">
<label v-text="__('messages.session_expiry_enter_password')" />
<small class="help-block text-red-500" v-if="errors.email" v-text="errors.email[0]" />
<small class="help-block text-red-500" v-if="errors.password" v-text="errors.password[0]" />
<div class="flex items-center">
<input
type="password"
v-model="password"
ref="password"
class="input-text"
tabindex="1"
autofocus
@keydown.enter.prevent="submit"
/>
<button @click="submit" class="btn-primary ltr:ml-2 rtl:mr-2" v-text="__('Log in')" />
</div>
<div v-if="!isUsingOauth" class="publish-fields p-2">
<div class="form-group w-full">
<label v-text="__('messages.session_expiry_enter_password')" />
<small class="help-block text-red-500" v-if="errors.email" v-text="errors.email[0]" />
<small class="help-block text-red-500" v-if="errors.password" v-text="errors.password[0]" />
<div class="flex items-center">
<Input
type="password"
v-model="password"
ref="password"
tabindex="1"
autofocus
@keydown.enter.prevent="submit"
/>
<Button @click="submit" class="ms-2" variant="primary" :text="__('Log in')" />
</div>
</div>
</div>
</modal>

<modal name="session-timeout-login" v-if="isShowingTwoFactorChallenge" height="auto" :width="500">
<div class="-max-h-screen-px">
<div
class="flex items-center justify-between rounded-t-lg border-b bg-gray-200 px-5 py-3 text-lg font-semibold dark:border-dark-900 dark:bg-dark-550"
>
{{ __('Resume Your Session') }}
</div>

<div class="publish-fields p-2">
<div v-if="twoFactorMode === 'code'" class="form-group w-full">
<label v-text="__('messages.session_expiry_enter_two_factor_code')" />
<small class="help-block text-red-500" v-if="errors.code" v-text="errors.code[0]" />
<div class="flex items-center">
<input
type="text"
name="code"
v-model="twoFactorCode"
ref="twoFactorCode"
class="input-text"
tabindex="1"
pattern="[0-9]*"
maxlength="6"
inputmode="numeric"
autofocus
autocomplete="one-time-code"
@keydown.enter.prevent="submitTwoFactorChallenge"
/>
</div>
</Modal>

<Modal :title="__('Resume Your Session')" :open="isShowingTwoFactorChallenge" height="auto" :width="500">
<div class="publish-fields p-2">
<div v-if="twoFactorMode === 'code'" class="form-group w-full">
<label v-text="__('messages.session_expiry_enter_two_factor_code')" />
<small class="help-block text-red-500" v-if="errors.code" v-text="errors.code[0]" />
<div class="flex items-center">
<Input
name="code"
v-model="twoFactorCode"
ref="twoFactorCode"
tabindex="1"
pattern="[0-9]*"
maxlength="6"
inputmode="numeric"
autofocus
autocomplete="one-time-code"
@keydown.enter.prevent="submitTwoFactorChallenge"
/>
</div>
</div>

<div v-if="twoFactorMode === 'recovery_code'" class="form-group w-full">
<label v-text="__('messages.session_expiry_enter_two_factor_recovery_code')" />
<small
class="help-block text-red-500"
v-if="errors.recovery_code"
v-text="errors.recovery_code[0]"
<div v-if="twoFactorMode === 'recovery_code'" class="form-group w-full">
<label v-text="__('messages.session_expiry_enter_two_factor_recovery_code')" />
<small
class="help-block text-red-500"
v-if="errors.recovery_code"
v-text="errors.recovery_code[0]"
/>
<div class="flex items-center">
<Input
name="recovery_code"
v-model="twoFactorRecoveryCode"
ref="twoFactorRecoveryCode"
tabindex="1"
maxlength="21"
autofocus
autocomplete="off"
@keydown.enter.prevent="submitTwoFactorChallenge"
/>
<div class="flex items-center">
<input
type="text"
name="recovery_code"
v-model="twoFactorRecoveryCode"
ref="twoFactorRecoveryCode"
class="input-text"
tabindex="1"
maxlength="21"
autofocus
autocomplete="off"
@keydown.enter.prevent="submitTwoFactorChallenge"
/>
</div>
</div>
</div>
</div>

<div
class="flex items-center justify-end border-t bg-gray-200 p-4 text-sm dark:border-dark-900 dark:bg-dark-550"
>
<button
<template #footer>
<div class="flex items-center justify-end space-x-3 pt-3 pb-1">
<Button
v-if="twoFactorMode === 'code'"
class="text-gray hover:text-gray-900 dark:text-dark-150 dark:hover:text-dark-100"
variant="ghost"
@click="twoFactorMode = 'recovery_code'"
v-text="__('Use recovery code')"
:text="__('Use recovery code')"
/>
<button
<Button
v-if="twoFactorMode === 'recovery_code'"
class="text-gray hover:text-gray-900 dark:text-dark-150 dark:hover:text-dark-100"
variant="ghost"
@click="twoFactorMode = 'code'"
v-text="__('Use one-time code')"
:text="__('Use one-time code')"
/>
<button
class="btn-primary ltr:ml-4 rtl:mr-4"
<Button
variant="primary"
@click="submitTwoFactorChallenge"
v-text="__('Continue')"
:text="__('Continue')"
/>
</div>
</div>
</modal>
</template>
</Modal>
</div>
</template>

<script>
import { Modal, Input, Button } from '@statamic/ui';

var counter;

export default {
components: {
Modal,
Input,
Button,
},

props: {
warnAt: Number,
lifetime: Number,
Expand Down
11 changes: 6 additions & 5 deletions resources/js/components/actions/ConfirmableAction.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup>
import { ref, computed, onUnmounted } from 'vue';
import PublishFields from '../publish/Fields.vue';
import { PublishContainer, FieldsProvider, PublishFields } from '@statamic/ui';
import { requireElevatedSessionIf } from '@statamic/components/elevated-sessions/index.js';

const props = defineProps({
Expand Down Expand Up @@ -115,17 +115,18 @@ defineExpose({
:class="{ 'mb-4': action.fields.length }"
/>

<publish-container
<PublishContainer
v-if="action.fields.length"
name="confirm-action"
:blueprint="fieldset"
:values="values"
:meta="action.meta"
:errors="errors"
@updated="values = $event"
v-slot="{ setFieldValue, setFieldMeta }"
>
<publish-fields :fields="action.fields" @updated="setFieldValue" @meta-updated="setFieldMeta" />
</publish-container>
<FieldsProvider :fields="action.fields">
<PublishFields />
</FieldsProvider>
</PublishContainer>
</confirmation-modal>
</template>
5 changes: 3 additions & 2 deletions resources/js/components/assets/Upload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,21 @@
@cancel="showNewFilenameModal = false"
@confirm="confirmNewFilename"
>
<text-input autoselect v-model="newFilename" @keydown.enter="confirmNewFilename" />
<Input autoselect v-model="newFilename" @keydown.enter="confirmNewFilename" />
</confirmation-modal>
</div>
</template>

<script>
import { Button, Dropdown, DropdownMenu, DropdownItem } from '@statamic/ui';
import { Button, Dropdown, DropdownMenu, DropdownItem, Input } from '@statamic/ui';

export default {
components: {
Button,
Dropdown,
DropdownMenu,
DropdownItem,
Input,
},

props: {
Expand Down
68 changes: 29 additions & 39 deletions resources/js/components/collections/DeleteEntryConfirmation.vue
Original file line number Diff line number Diff line change
@@ -1,44 +1,34 @@
<script setup>
import { Modal, ModalClose, Button } from '@statamic/ui';
import { ref } from 'vue';

const props = defineProps({
children: Number,
});

const modalOpen = ref(true);
const shouldDeleteChildren = ref(false);
</script>

<template>
<modal name="delete-entry-confirmation">
<div class="confirmation-modal flex h-full flex-col">
<div class="p-4 pb-0 text-lg font-medium">
{{ __('Delete Entry') }}
</div>
<div class="flex-1 px-4 py-6 text-gray dark:text-dark-150">
<p class="mb-4" v-text="__('Are you sure you want to delete this entry?')" />
<label class="flex items-center" v-if="children">
<input type="checkbox" class="ltr:mr-2 rtl:ml-2" v-model="shouldDeleteChildren" />
{{ __n('Delete child entry|Delete :count child entries', children) }}
</label>
</div>
<div
class="flex items-center justify-end border-t bg-gray-200 p-4 text-sm dark:border-dark-900 dark:bg-dark-550"
>
<button
class="text-gray hover:text-gray-900 dark:text-dark-150 dark:hover:text-dark-100"
@click="$emit('cancel')"
v-text="__('Cancel')"
/>
<button
class="btn-danger ltr:ml-4 rtl:mr-4"
<Modal :title="__('Delete Entry')" v-model:open="modalOpen">
<p class="mb-4" v-text="__('Are you sure you want to delete this entry?')" />
<label class="flex items-center" v-if="children">
<input type="checkbox" class="ltr:mr-2 rtl:ml-2" v-model="shouldDeleteChildren" />
{{ __n('Delete child entry|Delete :count child entries', children) }}
</label>

<template #footer>
<div class="flex items-center justify-end space-x-3 pt-3 pb-1">
<ModalClose>
<Button variant="ghost" :text="__('Cancel')" />
</ModalClose>
<Button
variant="primary"
:text="__('Delete')"
@click="$emit('confirm', shouldDeleteChildren)"
v-text="__('Delete')"
/>
</div>
</div>
</modal>
</template>
</Modal>
</template>

<script>
export default {
props: {
children: Number,
},

data() {
return {
shouldDeleteChildren: false,
};
},
};
</script>
Loading
Loading