handle team invitation for non registered user

This commit is contained in:
Čarodej
2022-02-12 11:28:08 +01:00
parent 4498461e70
commit 00c6562719
18 changed files with 216 additions and 51 deletions
+61 -11
View File
@@ -6,22 +6,37 @@
v-if="invitation"
:title="$t('Invitation To Join Team Folder')"
:description="
$t('{name} invite you to join with his team into shared team folder', {
$t('Jane invite you to join with his team into shared team folder', {
name: invitation.data.relationships.inviter.data.attributes.name,
})
"
>
<div class="relative mx-auto mb-10 w-24 text-center">
<VueFolderTeamIcon class="inline-block w-28" />
<MemberAvatar :member="invitation.data.relationships.inviter" class="absolute -bottom-2.5 -right-6" :is-border="true" :size="38" />
<MemberAvatar
:member="invitation.data.relationships.inviter"
class="absolute -bottom-2.5 -right-6"
:is-border="true"
:size="38"
/>
</div>
</Headline>
<p
v-if="invitation"
class="mx-auto mb-4 max-w-md text-sm text-gray-500"
v-html="
$t('Register account with your email peterpapp@makingcg.com and get access to this Team Folder.', {
email: invitation.data.attributes.email,
})
"
></p>
<AuthButton
@click.native="acceptInvitation"
class="mb-12 w-full justify-center md:w-min"
icon="chevron-right"
:text="$t('Accept Invitation')"
:text="acceptButton"
:loading="isLoading"
:disabled="isLoading"
/>
@@ -37,10 +52,17 @@
<!--Accepted invitation screen-->
<AuthContent v-if="invitation" name="accepted" :visible="false">
<Headline :title="$t('You are successfully joined')" :description="$t('You can now proceed to your account and participate in team folder')" />
<Headline
:title="$t('You are successfully joined')"
:description="$t('You can now proceed to your account and participate in team folder')"
/>
<router-link replace v-if="!config.isAuthenticated" :to="{ name: 'SignIn' }">
<AuthButton class="mb-12 w-full justify-center md:w-min" icon="chevron-right" :text="$t('Proceed to your account')" />
<AuthButton
class="mb-12 w-full justify-center md:w-min"
icon="chevron-right"
:text="$t('Proceed to your account')"
/>
</router-link>
<router-link
@@ -51,29 +73,47 @@
params: { id: invitation.data.attributes.parent_id },
}"
>
<AuthButton class="mb-12 w-full justify-center md:w-min" icon="chevron-right" :text="$t('Go to Team Folder')" />
<AuthButton
class="mb-12 w-full justify-center md:w-min"
icon="chevron-right"
:text="$t('Go to Team Folder')"
/>
</router-link>
</AuthContent>
<!--Denied invitation screen-->
<AuthContent name="denied" :visible="false">
<Headline :title="$t('You are successfully denied invitation')" :description="$t('You can now proceed to your account')" />
<Headline
:title="$t('You are successfully denied invitation')"
:description="$t('You can now proceed to your account')"
/>
<router-link :to="{ name: 'SignIn' }">
<AuthButton class="mb-12 w-full justify-center md:w-min" icon="chevron-right" :text="$t('Proceed to your account')" />
<AuthButton
class="mb-12 w-full justify-center md:w-min"
icon="chevron-right"
:text="$t('Proceed to your account')"
/>
</router-link>
</AuthContent>
<!--Used or Expired invitation screen-->
<AuthContent name="expired" :visible="false">
<Headline :title="$t('Your invitation has been used')" :description="$t('We are sorry but this invitation was used previously')" />
<Headline
:title="$t('Your invitation has been used')"
:description="$t('We are sorry but this invitation was used previously')"
/>
<router-link replace v-if="!config.isAuthenticated" :to="{ name: 'SignIn' }">
<AuthButton class="mb-12 w-full justify-center md:w-min" icon="chevron-right" :text="$t('Log In')" />
</router-link>
<router-link replace v-if="config.isAuthenticated" :to="{ name: 'SharedWithMe' }">
<AuthButton class="mb-12 w-full justify-center md:w-min" icon="chevron-right" :text="$t('Go to your shared folders')" />
<AuthButton
class="mb-12 w-full justify-center md:w-min"
icon="chevron-right"
:text="$t('Go to your shared folders')"
/>
</router-link>
</AuthContent>
</AuthContentWrapper>
@@ -106,6 +146,11 @@ export default {
},
computed: {
...mapGetters(['config']),
acceptButton() {
return this.invitation && this.invitation.data.attributes.isExistedUser
? this.$t('Accept Invitation')
: this.$t('Accept and Register Account')
},
},
data() {
return {
@@ -121,7 +166,12 @@ export default {
axios
.put(`/api/teams/invitations/${this.$router.currentRoute.params.id}`)
.then(() => {
this.goToAuthPage('accepted')
if (this.invitation.data.attributes.isExistedUser) {
this.goToAuthPage('accepted')
} else {
this.$router.push({name: 'SignUp'})
}
})
.catch(() => {
this.$isSomethingWrong()