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()
|
||||
|
||||
export const signin = async (email: string, language: string): Promise<boolean> => {
|
||||
const fields = {}
|
||||
export const signin = async (
|
||||
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 result = await klicktippConnector.signin(apiKey, email, fields)
|
||||
return result
|
||||
|
||||
@ -8,6 +8,8 @@ export class CheckEmailResponse {
|
||||
this.sessionId = json.session_id
|
||||
this.email = json.user.email
|
||||
this.language = json.user.language
|
||||
this.firstName = json.user.first_name
|
||||
this.lastName = json.user.last_name
|
||||
}
|
||||
|
||||
@Field(() => Number)
|
||||
@ -16,6 +18,12 @@ export class CheckEmailResponse {
|
||||
@Field(() => String)
|
||||
email: string
|
||||
|
||||
@Field(() => String)
|
||||
firstName: string
|
||||
|
||||
@Field(() => String)
|
||||
lastName: string
|
||||
|
||||
@Field(() => String)
|
||||
language: string
|
||||
}
|
||||
|
||||
@ -166,7 +166,9 @@ export class UserResolver {
|
||||
@Query(() => CheckEmailResponse)
|
||||
@UseMiddleware(klicktippRegistrationMiddleware)
|
||||
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) {
|
||||
throw new Error(result.data)
|
||||
}
|
||||
|
||||
@ -10,6 +10,6 @@ export const klicktippRegistrationMiddleware: MiddlewareFn = async (
|
||||
// Do Something here before resolver is called
|
||||
const result = await next()
|
||||
// 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
|
||||
}
|
||||
|
||||
@ -127,7 +127,7 @@
|
||||
},
|
||||
"checkEmail": {
|
||||
"title": "Email wird verifiziert",
|
||||
"error-text": "Email konnte nicht verifiziert werden."
|
||||
"errorText": "Email konnte nicht verifiziert werden."
|
||||
},
|
||||
"thx": {
|
||||
"title": "Danke!",
|
||||
|
||||
@ -127,7 +127,7 @@
|
||||
},
|
||||
"checkEmail": {
|
||||
"title": "Verifing email",
|
||||
"error-text": "Could not verify the email."
|
||||
"errorText": "Could not verify the email."
|
||||
},
|
||||
"thx": {
|
||||
"title": "Thank you!",
|
||||
|
||||
@ -5,10 +5,10 @@
|
||||
<div class="header-body text-center mb-7">
|
||||
<b-row class="justify-content-center">
|
||||
<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">
|
||||
<span v-if="!authenticated">
|
||||
{{ $t('check-email.error-text') }}
|
||||
{{ $t('checkEmail.errorText') }}
|
||||
</span>
|
||||
</div>
|
||||
</b-col>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user