mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Implement 'inviteCode' in webapp calling Mutations 'Signup', 'SignupVerify'
- Replace in calls of 'setSliderValuesCallback' 'this.sliderData.sliders[this.sliderIndex].validated' by 'null', because validation does not change.
This commit is contained in:
parent
72450346a7
commit
266ed76639
@ -280,17 +280,18 @@ export default {
|
||||
},
|
||||
async submit() {
|
||||
const { name, password, about } = this.formData
|
||||
const { email, nonce } = this.sliderData.collectedInputData
|
||||
const { email, inviteCode = null, nonce } = this.sliderData.collectedInputData
|
||||
const termsAndConditionsAgreedVersion = VERSION
|
||||
const locale = this.$i18n.locale()
|
||||
try {
|
||||
await this.$apollo.mutate({
|
||||
mutation: SignupVerificationMutation, // Wolle add nonce in 'SignupVerificationMutation' definition in case
|
||||
mutation: SignupVerificationMutation,
|
||||
variables: {
|
||||
name,
|
||||
password,
|
||||
about,
|
||||
email,
|
||||
inviteCode,
|
||||
nonce,
|
||||
termsAndConditionsAgreedVersion,
|
||||
locale,
|
||||
|
||||
@ -68,10 +68,9 @@ import { isEmail } from 'validator'
|
||||
import normalizeEmail from '~/components/utils/NormalizeEmail'
|
||||
// Wolle import { SweetalertIcon } from 'vue-sweetalert-icons'
|
||||
|
||||
// Wolle add nonce in in case
|
||||
export const SignupMutation = gql`
|
||||
mutation($email: String!) {
|
||||
Signup(email: $email) {
|
||||
mutation($email: String!, $inviteCode: String) {
|
||||
Signup(email: $email, inviteCode: $inviteCode) {
|
||||
email
|
||||
}
|
||||
}
|
||||
@ -183,7 +182,8 @@ export default {
|
||||
},
|
||||
async onNextClick() {
|
||||
const { email } = this.formData
|
||||
const variables = { email } // Wolle add nonce in case
|
||||
const { inviteCode = null } = this.sliderData.collectedInputData
|
||||
const variables = { email, inviteCode }
|
||||
|
||||
if (!this.sendEmailAgain && this.sliderData.collectedInputData.emailSend) {
|
||||
return true
|
||||
@ -192,10 +192,9 @@ export default {
|
||||
if (this.sendEmailAgain || !this.isVariablesRequested(variables)) {
|
||||
try {
|
||||
const response = await this.$apollo.mutate({ SignupMutation, variables }) // e-mail is send in emailMiddleware of backend
|
||||
this.sliderData.setSliderValuesCallback(
|
||||
this.sliderData.sliders[this.sliderIndex].validated,
|
||||
{ sliderData: { request: { variables }, response: response.data } },
|
||||
)
|
||||
this.sliderData.setSliderValuesCallback(null, {
|
||||
sliderData: { request: { variables }, response: response.data },
|
||||
})
|
||||
|
||||
if (this.sliderData.sliders[this.sliderIndex].data.response) {
|
||||
this.sliderData.setSliderValuesCallback(this.validInput, {
|
||||
@ -212,10 +211,9 @@ export default {
|
||||
}
|
||||
return true
|
||||
} catch (err) {
|
||||
this.sliderData.setSliderValuesCallback(
|
||||
this.sliderData.sliders[this.sliderIndex].validated,
|
||||
{ sliderData: { request: null, response: null } },
|
||||
)
|
||||
this.sliderData.setSliderValuesCallback(null, {
|
||||
sliderData: { request: null, response: null },
|
||||
})
|
||||
this.sliderData.setSliderValuesCallback(this.validInput, {
|
||||
collectedInputData: { emailSend: false },
|
||||
})
|
||||
|
||||
@ -121,10 +121,9 @@ export default {
|
||||
)
|
||||
}
|
||||
} catch (err) {
|
||||
this.sliderData.setSliderValuesCallback(
|
||||
this.sliderData.sliders[this.sliderIndex].validated,
|
||||
{ sliderData: { response: { isValidInviteCode: false } } },
|
||||
)
|
||||
this.sliderData.setSliderValuesCallback(null, {
|
||||
sliderData: { response: { isValidInviteCode: false } },
|
||||
})
|
||||
|
||||
const { message } = err
|
||||
this.$toast.error(message)
|
||||
|
||||
@ -113,10 +113,9 @@ export default {
|
||||
if (!this.isVariablesRequested(variables)) {
|
||||
try {
|
||||
const response = await this.$apollo.query({ query: verifyNonceQuery, variables })
|
||||
this.sliderData.setSliderValuesCallback(
|
||||
this.sliderData.sliders[this.sliderIndex].validated,
|
||||
{ sliderData: { request: { variables }, response: response.data } },
|
||||
)
|
||||
this.sliderData.setSliderValuesCallback(null, {
|
||||
sliderData: { request: { variables }, response: response.data },
|
||||
})
|
||||
|
||||
if (
|
||||
this.sliderData.sliders[this.sliderIndex].data.response &&
|
||||
@ -127,10 +126,9 @@ export default {
|
||||
)
|
||||
}
|
||||
} catch (err) {
|
||||
this.sliderData.setSliderValuesCallback(
|
||||
this.sliderData.sliders[this.sliderIndex].validated,
|
||||
{ sliderData: { response: { VerifyNonce: false } } },
|
||||
)
|
||||
this.sliderData.setSliderValuesCallback(null, {
|
||||
sliderData: { response: { VerifyNonce: false } },
|
||||
})
|
||||
|
||||
const { message } = err
|
||||
this.$toast.error(message)
|
||||
|
||||
@ -69,8 +69,8 @@ import metadata from '~/constants/metadata'
|
||||
import { SweetalertIcon } from 'vue-sweetalert-icons'
|
||||
|
||||
export const SignupMutation = gql`
|
||||
mutation($email: String!) {
|
||||
Signup(email: $email) {
|
||||
mutation($email: String!, $inviteCode: String) {
|
||||
Signup(email: $email, inviteCode: $inviteCode) {
|
||||
email
|
||||
}
|
||||
}
|
||||
@ -118,7 +118,10 @@ export default {
|
||||
const { email } = this.formData
|
||||
|
||||
try {
|
||||
const response = await this.$apollo.mutate({ SignupMutation, variables: { email } })
|
||||
const response = await this.$apollo.mutate({
|
||||
SignupMutation,
|
||||
variables: { email, inviteCode: null },
|
||||
})
|
||||
this.data = response.data
|
||||
setTimeout(() => {
|
||||
this.$emit('submit', { email: this.data.Signup.email })
|
||||
|
||||
@ -4,6 +4,7 @@ export const SignupVerificationMutation = gql`
|
||||
$nonce: String!
|
||||
$name: String!
|
||||
$email: String!
|
||||
$inviteCode: String
|
||||
$password: String!
|
||||
$about: String
|
||||
$termsAndConditionsAgreedVersion: String!
|
||||
@ -12,6 +13,7 @@ export const SignupVerificationMutation = gql`
|
||||
SignupVerification(
|
||||
nonce: $nonce
|
||||
email: $email
|
||||
inviteCode: $inviteCode
|
||||
name: $name
|
||||
password: $password
|
||||
about: $about
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user