mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Implementation of signup to Klicktipp.
This commit is contained in:
parent
1b6cb61530
commit
c5a65da94c
@ -5,8 +5,16 @@ import CONFIG from '../config'
|
|||||||
|
|
||||||
const klicktippConnector = new KlicktippConnector()
|
const klicktippConnector = new KlicktippConnector()
|
||||||
|
|
||||||
export const signin = async (email: string, language: string): Promise<boolean> => {
|
export const signin = async (
|
||||||
const fields = {}
|
email: string,
|
||||||
|
language: string,
|
||||||
|
firstName: string,
|
||||||
|
lastName: string,
|
||||||
|
): Promise<boolean> => {
|
||||||
|
const fields = {
|
||||||
|
fieldFirstName: firstName,
|
||||||
|
fieldLastName: lastName,
|
||||||
|
}
|
||||||
const apiKey = language === 'de' ? CONFIG.KLICKTIPP_APIKEY_DE : CONFIG.KLICKTIPP_APIKEY_EN
|
const apiKey = language === 'de' ? CONFIG.KLICKTIPP_APIKEY_DE : CONFIG.KLICKTIPP_APIKEY_EN
|
||||||
const result = await klicktippConnector.signin(apiKey, email, fields)
|
const result = await klicktippConnector.signin(apiKey, email, fields)
|
||||||
return result
|
return result
|
||||||
|
|||||||
@ -8,6 +8,8 @@ export class CheckEmailResponse {
|
|||||||
this.sessionId = json.session_id
|
this.sessionId = json.session_id
|
||||||
this.email = json.user.email
|
this.email = json.user.email
|
||||||
this.language = json.user.language
|
this.language = json.user.language
|
||||||
|
this.firstName = json.user.first_name
|
||||||
|
this.lastName = json.user.last_name
|
||||||
}
|
}
|
||||||
|
|
||||||
@Field(() => Number)
|
@Field(() => Number)
|
||||||
@ -16,6 +18,12 @@ export class CheckEmailResponse {
|
|||||||
@Field(() => String)
|
@Field(() => String)
|
||||||
email: string
|
email: string
|
||||||
|
|
||||||
|
@Field(() => String)
|
||||||
|
firstName: string
|
||||||
|
|
||||||
|
@Field(() => String)
|
||||||
|
lastName: string
|
||||||
|
|
||||||
@Field(() => String)
|
@Field(() => String)
|
||||||
language: string
|
language: string
|
||||||
}
|
}
|
||||||
|
|||||||
@ -166,7 +166,9 @@ export class UserResolver {
|
|||||||
@Query(() => CheckEmailResponse)
|
@Query(() => CheckEmailResponse)
|
||||||
@UseMiddleware(klicktippRegistrationMiddleware)
|
@UseMiddleware(klicktippRegistrationMiddleware)
|
||||||
async checkEmail(@Arg('optin') optin: string): Promise<CheckEmailResponse> {
|
async checkEmail(@Arg('optin') optin: string): Promise<CheckEmailResponse> {
|
||||||
const result = await apiGet(CONFIG.LOGIN_API_URL + 'checkEmail/' + optin)
|
const result = await apiGet(
|
||||||
|
CONFIG.LOGIN_API_URL + 'loginViaEmailVerificationCode?emailVerificationCode=' + optin,
|
||||||
|
)
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
throw new Error(result.data)
|
throw new Error(result.data)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,6 +10,6 @@ export const klicktippRegistrationMiddleware: MiddlewareFn = async (
|
|||||||
// Do Something here before resolver is called
|
// Do Something here before resolver is called
|
||||||
const result = await next()
|
const result = await next()
|
||||||
// Do Something here after resolver is completed
|
// Do Something here after resolver is completed
|
||||||
signin(result.data.checkEmail.email, result.data.checkEmail.language)
|
signin(result.email, result.language, result.firstName, result.lastName)
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|||||||
@ -127,7 +127,7 @@
|
|||||||
},
|
},
|
||||||
"checkEmail": {
|
"checkEmail": {
|
||||||
"title": "Email wird verifiziert",
|
"title": "Email wird verifiziert",
|
||||||
"error-text": "Email konnte nicht verifiziert werden."
|
"errorText": "Email konnte nicht verifiziert werden."
|
||||||
},
|
},
|
||||||
"thx": {
|
"thx": {
|
||||||
"title": "Danke!",
|
"title": "Danke!",
|
||||||
|
|||||||
@ -127,7 +127,7 @@
|
|||||||
},
|
},
|
||||||
"checkEmail": {
|
"checkEmail": {
|
||||||
"title": "Verifing email",
|
"title": "Verifing email",
|
||||||
"error-text": "Could not verify the email."
|
"errorText": "Could not verify the email."
|
||||||
},
|
},
|
||||||
"thx": {
|
"thx": {
|
||||||
"title": "Thank you!",
|
"title": "Thank you!",
|
||||||
|
|||||||
@ -5,10 +5,10 @@
|
|||||||
<div class="header-body text-center mb-7">
|
<div class="header-body text-center mb-7">
|
||||||
<b-row class="justify-content-center">
|
<b-row class="justify-content-center">
|
||||||
<b-col xl="5" lg="6" md="8" class="px-2">
|
<b-col xl="5" lg="6" md="8" class="px-2">
|
||||||
<h1>{{ $t('check-email.title') }}</h1>
|
<h1>{{ $t('checkEmail.title') }}</h1>
|
||||||
<div class="pb-4" v-if="!pending">
|
<div class="pb-4" v-if="!pending">
|
||||||
<span v-if="!authenticated">
|
<span v-if="!authenticated">
|
||||||
{{ $t('check-email.error-text') }}
|
{{ $t('checkEmail.errorText') }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</b-col>
|
</b-col>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user