Skip to content

Commit

Permalink
Move password field to join/setup
Browse files Browse the repository at this point in the history
  • Loading branch information
wpf500 committed Jul 31, 2024
1 parent 92e2a13 commit a7293a7
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 29 deletions.
17 changes: 1 addition & 16 deletions apps/frontend/src/components/pages/join/AccountSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,6 @@
required
/>
</div>

<AppInput
v-model="passwordProxy"
:label="t('form.password')"
type="password"
name="password"
required
:info-message="t('form.passwordInfo')"
/>
</section>
</template>

Expand All @@ -49,21 +40,15 @@ import { computed } from 'vue';
import AppSubHeading from '../../AppSubHeading.vue';
import { isEmbed } from '../../../store';
const emit = defineEmits(['update:email', 'update:password']);
const emit = defineEmits(['update:email']);
const props = defineProps<{
email: string;
password: string;
}>();
const emailProxy = computed({
get: () => props.email,
set: (email) => emit('update:email', email),
});
const passwordProxy = computed({
get: () => props.password,
set: (password) => emit('update:password', password),
});
const { t } = useI18n();
</script>
7 changes: 1 addition & 6 deletions apps/frontend/src/components/pages/join/JoinForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
<AccountSection
v-if="generalContent.hideContribution"
v-model:email="signUpData.email"
v-model:password="signUpData.password"
class="mb-6"
/>
<Contribution
Expand All @@ -27,11 +26,7 @@
class="mb-4"
:label="t('join.noContribution')"
/>
<AccountSection
v-model:email="signUpData.email"
v-model:password="signUpData.password"
class="my-6"
/>
<AccountSection v-model:email="signUpData.email" class="my-6" />
</Contribution>
</AppForm>

Expand Down
11 changes: 11 additions & 0 deletions apps/frontend/src/components/pages/join/SetupForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@
v-model:firstName="data.firstName"
v-model:lastName="data.lastName"
/>

<AppInput
v-model="data.password"
:label="t('form.password')"
type="password"
name="password"
required
:info-message="t('form.passwordInfo')"
/>
</div>

<section v-if="setupContent.showMailOptIn" class="mb-6">
Expand Down Expand Up @@ -82,6 +91,7 @@ import AppCheckboxGroup from '@components/forms/AppCheckboxGroup.vue';
import { type SetupContactData } from './join.interface';
import { fetchContact } from '@utils/api/contact';
import AppInput from '@components/forms/AppInput.vue';
const props = defineProps<{
setupContent: ContentJoinSetupData;
Expand All @@ -99,6 +109,7 @@ const data = reactive<SetupContactData>({
email: contact.email,
firstName: contact.firstname,
lastName: contact.lastname,
password: '',
profile: {
newsletterOptIn:
contact.profile.newsletterStatus === NewsletterStatus.Subscribed,
Expand Down
1 change: 1 addition & 0 deletions apps/frontend/src/components/pages/join/join.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export interface SetupContactData {
email: string;
firstName: string;
lastName: string;
password: string;
profile: {
newsletterOptIn: boolean;
newsletterGroups: string[];
Expand Down
1 change: 0 additions & 1 deletion apps/frontend/src/components/pages/join/use-join.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const { n, t } = i18n.global;

const signUpData = reactive({
email: '',
password: '',
amount: 5,
period: ContributionPeriod.Monthly,
payFee: true,
Expand Down
8 changes: 4 additions & 4 deletions apps/frontend/src/pages/join/setup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ meta:
import {
NewsletterStatus,
type ContentJoinSetupData,
type UpdateContactData,
type UpdateContactProfileData,
} from '@beabee/beabee-common';
import { onBeforeMount, ref } from 'vue';
Expand Down Expand Up @@ -65,6 +64,7 @@ async function handleSubmitSetup(data: SetupContactData) {
newsletterStatus: NewsletterStatus.Subscribed,
newsletterGroups: data.profile.newsletterGroups,
}),
// Only set mail opt-in if the opt-in was visible
...(setupContent.value.showMailOptIn && {
deliveryOptIn: data.profile.deliveryOptIn,
deliveryAddress: {
Expand All @@ -76,14 +76,14 @@ async function handleSubmitSetup(data: SetupContactData) {
}),
};
const updateContactData: UpdateContactData = {
const updatedContact = await updateContact('me', {
email: data.email,
firstname: data.firstName,
lastname: data.lastName,
password: data.password,
...(Object.keys(profile).length > 0 && { profile }),
};
});
const updatedContact = await updateContact('me', updateContactData);
await updateCurrentUser(updatedContact);
if (setupContent.value.surveySlug) {
Expand Down
1 change: 0 additions & 1 deletion apps/frontend/src/type/signup-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@ import type { StartContributionData } from '@type';

export interface SignupData extends StartContributionData {
email: string;
password: string;
noContribution: boolean;
}
1 change: 0 additions & 1 deletion apps/frontend/src/utils/api/signup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export async function signUp(data: SignupData): Promise<PaymentFlowParams> {
return (
await instance.post<Serial<PaymentFlowParams>>('/signup', {
email: data.email,
password: data.password,
loginUrl: env.appUrl + '/auth/login',
setPasswordUrl: env.appUrl + '/auth/set-password',
confirmUrl: env.appUrl + '/join/confirm-email',
Expand Down

0 comments on commit a7293a7

Please sign in to comment.