-
Notifications
You must be signed in to change notification settings - Fork 30
Refactor flow entering guest name and guest access #3275
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
Open
Sabr1n4W
wants to merge
41
commits into
develop
Choose a base branch
from
refactor-flow-entering-guest-name-and-guest-access
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
cd96a3d
Move guest name to access code overlay
Sabr1n4W a4614b6
Persist access code and personalized link
Sabr1n4W 8478aa1
Merge remote-tracking branch 'origin/develop' into refactor-flow-ente…
Sabr1n4W 663fb83
Code cleanup
Sabr1n4W 2d70b1f
Add legacy route for personalized room links
Sabr1n4W 4f3e188
Merge remote-tracking branch 'origin/develop' into refactor-flow-ente…
Sabr1n4W c146655
Code Cleanup
Sabr1n4W 0f5580e
Switch to alternative design
Sabr1n4W 1deb299
Set accessCode in sessionStorage after read from hash
Sabr1n4W e86047d
Improve alternative design and move warning messages
Sabr1n4W 712bac0
Start adjusting frontend tests
Sabr1n4W c345e7c
Start adding frontend validation for guest name
Sabr1n4W 446d734
Clear access code item in sessionStorage after require_code errors
Sabr1n4W 23a9edd
Improve spacing
Sabr1n4W 0a85f89
Code cleanup
Sabr1n4W 98724ab
Merge remote-tracking branch 'origin/develop' into refactor-flow-ente…
Sabr1n4W c6a23b0
Add missing frontend tests
Sabr1n4W 89905aa
Adjust system tests
Sabr1n4W 152a86f
Reset tab hash when falling back to default tab in tab sections
Sabr1n4W 360e970
Merge remote-tracking branch 'origin/develop' into refactor-flow-ente…
Sabr1n4W 2da2bf9
Move participant name validation from frontend to backend
Sabr1n4W 368f883
Merge remote-tracking branch 'origin/develop' into refactor-flow-ente…
Sabr1n4W f96f113
Improve padding
Sabr1n4W bdb4e98
Improve room join participant name error message
Sabr1n4W 309d0e3
Add invalid room tab hash test
Sabr1n4W ee51bc6
Fix cs
Sabr1n4W dc651df
Cleanup
Sabr1n4W 5d72cf7
Merge remote-tracking branch 'origin/develop' into refactor-flow-ente…
Sabr1n4W 3c0ebc4
Update changelog
Sabr1n4W 39ec95c
Add missing intercepts
Sabr1n4W 0095def
Move guests only check to initializeRoomView
Sabr1n4W 6302074
Improve saved access parameter priority
Sabr1n4W 5b8acaf
Cleanup
Sabr1n4W b91f184
Improve padding inside room tab section
Sabr1n4W e6fad45
Cleanup
Sabr1n4W 9175f22
Improve personalized links hash and sessionStorage handling
Sabr1n4W 330f562
Update resources/js/components/RoomJoinButton.vue
Sabr1n4W cca1e54
Update resources/js/components/RoomAccessOverlay.vue
Sabr1n4W 7300ae4
Combine load and reload, add listener for hash changes and improve er…
Sabr1n4W d03fe1f
Improve error handling and loading states
Sabr1n4W f149d81
Change to full page reload on hash change
Sabr1n4W File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace App\Http\Requests; | ||
|
|
||
| use App\Rules\ValidName; | ||
| use Illuminate\Foundation\Http\FormRequest; | ||
|
|
||
| class ValidateParticipantNameRequest extends FormRequest | ||
| { | ||
| public function rules(): array | ||
| { | ||
| return [ | ||
| 'name' => self::participantNameValidationRules(), | ||
| ]; | ||
| } | ||
|
|
||
| public static function participantNameValidationRules(): array | ||
| { | ||
| return ['bail', 'required', 'min:2', 'max:50', new ValidName]; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,237 @@ | ||
| <template> | ||
| <Card | ||
| style="width: 500px; max-width: 90vw" | ||
| :pt="{ header: { class: 'flex justify-center' } }" | ||
| data-test="room-access-overlay" | ||
| > | ||
| <template #header> | ||
| <Badge | ||
| v-if="!room.authenticated" | ||
| severity="danger" | ||
| class="-mt-8 flex !h-16 !w-16 items-center justify-center rounded-full" | ||
| > | ||
| <i class="fa-solid fa-lock text-2xl text-white"></i> | ||
| </Badge> | ||
|
samuelwei marked this conversation as resolved.
|
||
| </template> | ||
| <template #content> | ||
| <RoomHeader | ||
| :room="room" | ||
| :loading="loading || isLoadingAction" | ||
| :details-inline="false" | ||
| :hide-favorites="true" | ||
| :hide-membership="true" | ||
| :disable-reload="authThrottledFor > 0" | ||
| :bbb-errors="bbbErrors" | ||
| :bbb-reason="bbbReason" | ||
| @reload="emit('reload')" | ||
| /> | ||
|
|
||
| <div | ||
| v-if="!authStore.isAuthenticated" | ||
| class="mt-4 flex w-full flex-col gap-2" | ||
| > | ||
| <Button | ||
| data-test="room-login-as-user-button" | ||
| icon="fa-solid fa-right-to-bracket" | ||
| :label="$t('auth.offer_login')" | ||
| as="router-link" | ||
| :to="{ name: 'login', query: { redirect: $route.path } }" | ||
| /> | ||
|
|
||
| <Divider class="m-1">{{ $t("app.or").toUpperCase() }}</Divider> | ||
| </div> | ||
|
|
||
| <Form :disabled="authThrottledFor > 0" @submit="submit"> | ||
| <div | ||
| v-if="!authStore.isAuthenticated" | ||
| class="field flex flex-col gap-2" | ||
| data-test="participant-name-field" | ||
| > | ||
| <label for="participant-name">{{ | ||
| $t("rooms.first_and_lastname") | ||
| }}</label> | ||
| <InputText | ||
| id="participant-name" | ||
| v-model="participantNameInput" | ||
| :disabled="authThrottledFor > 0 || loading || isLoadingAction" | ||
| :invalid="formErrors.fieldInvalid('name')" | ||
| /> | ||
|
|
||
| <div class="flex items-center gap-2"> | ||
| <Checkbox | ||
| v-model="rememberParticipantName" | ||
| input-id="remember-participant-name" | ||
| :disabled="authThrottledFor > 0 || loading || isLoadingAction" | ||
| binary | ||
| /> | ||
| <label for="remember-participant-name"> | ||
| {{ $t("rooms.remember_participant_name") }} | ||
| </label> | ||
| </div> | ||
|
|
||
| <FormError :errors="formErrors.fieldError('name')" /> | ||
| </div> | ||
|
|
||
| <div | ||
| v-if="!room.authenticated" | ||
| class="field mt-4 flex flex-col gap-2" | ||
| data-test="access-code-field" | ||
| > | ||
| <label for="access-code">{{ $t("rooms.access_code") }}</label> | ||
| <InputMask | ||
| id="access-code" | ||
| v-model="accessCodeInput" | ||
| autofocus | ||
| :mask="room.legacy_code ? '******' : '999-999-999'" | ||
| :placeholder="room.legacy_code ? '123abc' : '123-456-789'" | ||
| :invalid=" | ||
| accessCodeInvalid || formErrors.fieldInvalid('access_code') | ||
| " | ||
| :disabled="authThrottledFor > 0 || loading || isLoadingAction" | ||
| class="text-center" | ||
| @keydown.enter="submit" | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| /> | ||
|
Sabr1n4W marked this conversation as resolved.
|
||
| <FormError :errors="formErrors.fieldError('access_code')" /> | ||
| <FormError :errors="accessCodeErrors" /> | ||
| </div> | ||
|
|
||
| <Button | ||
| class="mt-6 w-full" | ||
| type="submit" | ||
| :loading="loading || isLoadingAction" | ||
| :label=" | ||
| authStore.isAuthenticated | ||
| ? $t('app.continue') | ||
| : $t('rooms.continue_as_guest') | ||
| " | ||
| data-test="room-login-button" | ||
| :disabled="authThrottledFor > 0 || loading || isLoadingAction" | ||
| /> | ||
| </Form> | ||
| </template> | ||
| </Card> | ||
| </template> | ||
|
|
||
| <script setup> | ||
| import RoomHeader from "./RoomHeader.vue"; | ||
| import { useAuthStore } from "../stores/auth.js"; | ||
| import { computed, onMounted, ref, watch } from "vue"; | ||
| import { useApi } from "../composables/useApi.js"; | ||
| import { HTTP_STATUS_UNPROCESSABLE_ENTITY } from "../constants/httpStatusCodes.js"; | ||
| import { useI18n } from "vue-i18n"; | ||
|
|
||
| const emit = defineEmits(["submit", "reload"]); | ||
| const props = defineProps({ | ||
| room: { | ||
| type: Object, | ||
| required: true, | ||
| }, | ||
| loading: { | ||
| type: Boolean, | ||
| default: false, | ||
| }, | ||
| authThrottledFor: { | ||
| type: Number, | ||
| default: 0, | ||
| }, | ||
| accessCodeInvalid: { | ||
| type: Boolean, | ||
| default: false, | ||
| }, | ||
| formErrors: { | ||
| type: Object, | ||
| required: true, | ||
| }, | ||
| bbbErrors: { | ||
| type: String, | ||
| default: null, | ||
| }, | ||
| bbbReason: { | ||
| type: String, | ||
| default: null, | ||
| }, | ||
| }); | ||
|
|
||
| const accessCode = defineModel("accessCode", { | ||
| type: String, | ||
| default: "", | ||
| }); | ||
|
|
||
| const participantName = defineModel("participantName", { | ||
| type: String, | ||
| default: "", | ||
| }); | ||
|
|
||
| const rememberParticipantName = defineModel("rememberParticipantName", { | ||
| type: Boolean, | ||
| default: false, | ||
| }); | ||
| const participantNameInput = ref(""); | ||
| const accessCodeInput = ref(""); | ||
| const isLoadingAction = ref(false); | ||
|
|
||
| const authStore = useAuthStore(); | ||
| const api = useApi(); | ||
| const { t } = useI18n(); | ||
|
|
||
| const accessCodeErrors = computed(() => { | ||
| if (props.authThrottledFor > 0) { | ||
| return [t("rooms.auth_throttled", { try_again: props.authThrottledFor })]; | ||
| } | ||
|
|
||
| if (props.accessCodeInvalid) { | ||
| return [t("rooms.flash.access_code_invalid")]; | ||
| } | ||
|
|
||
| return []; | ||
| }); | ||
|
|
||
| onMounted(() => { | ||
| participantNameInput.value = participantName.value; | ||
| accessCodeInput.value = accessCode.value; | ||
| }); | ||
|
|
||
| watch(participantName, (value) => { | ||
| participantNameInput.value = value; | ||
| }); | ||
|
Comment on lines
+194
to
+196
|
||
|
|
||
| function submit() { | ||
| if (authStore.isAuthenticated) { | ||
| accessCode.value = accessCodeInput.value; | ||
| emit("submit"); | ||
| return; | ||
| } | ||
|
|
||
| props.formErrors.clear(); | ||
| isLoadingAction.value = true; | ||
|
|
||
| const newParticipantName = participantNameInput.value; | ||
|
|
||
| api | ||
| .call("participantName/check", { | ||
| method: "post", | ||
| data: { | ||
| name: newParticipantName, | ||
| }, | ||
| }) | ||
| .then(() => { | ||
| accessCode.value = accessCodeInput.value; | ||
| participantName.value = newParticipantName; | ||
| emit("submit"); | ||
| }) | ||
| .catch((error) => { | ||
| if ( | ||
| error.response && | ||
| error.response.status === HTTP_STATUS_UNPROCESSABLE_ENTITY | ||
| ) { | ||
| props.formErrors.set(error.response.data.errors); | ||
| return; | ||
| } | ||
|
|
||
| api.error(error); | ||
| }) | ||
| .finally(() => { | ||
| isLoadingAction.value = false; | ||
| }); | ||
| } | ||
| </script> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.