mirror of
https://github.com/IT4Change/gradido.git
synced 2026-03-29 05:35:41 +00:00
set validUntil in DisbersementLink by exp-claim of jwt-payload
This commit is contained in:
parent
09c5aac8e6
commit
3770be4274
@ -26,6 +26,9 @@ export class DisbursementLink {
|
||||
this.amount = new Decimal(disbursementPayload.amount)
|
||||
this.memo = disbursementPayload.memo
|
||||
this.code = disbursementPayload.redeemcode
|
||||
if (disbursementPayload.exp) {
|
||||
this.validUntil = new Date(disbursementPayload.exp)
|
||||
}
|
||||
}
|
||||
|
||||
@Field(() => Community)
|
||||
@ -48,4 +51,7 @@ export class DisbursementLink {
|
||||
|
||||
@Field(() => String)
|
||||
code: string
|
||||
|
||||
@Field(() => Date)
|
||||
validUntil: Date
|
||||
}
|
||||
|
||||
@ -190,7 +190,9 @@ export class TransactionLinkResolver {
|
||||
)
|
||||
if (
|
||||
decodedPayload != null &&
|
||||
decodedPayload.tokentype === DisbursementJwtPayloadType.REDEEM_ACTIVATION_TYPE
|
||||
decodedPayload.tokentype === DisbursementJwtPayloadType.REDEEM_ACTIVATION_TYPE &&
|
||||
decodedPayload.exp &&
|
||||
decodedPayload.exp > new Date().getTime()
|
||||
) {
|
||||
const disburseJwtPayload = new DisbursementJwtPayloadType(
|
||||
decodedPayload.sendercommunityuuid as string,
|
||||
@ -224,7 +226,9 @@ export class TransactionLinkResolver {
|
||||
let verifiedPayload: DisbursementJwtPayloadType | null = null
|
||||
if (
|
||||
jwtPayload != null &&
|
||||
jwtPayload.tokentype === DisbursementJwtPayloadType.REDEEM_ACTIVATION_TYPE
|
||||
jwtPayload.tokentype === DisbursementJwtPayloadType.REDEEM_ACTIVATION_TYPE &&
|
||||
jwtPayload.exp &&
|
||||
jwtPayload.exp > new Date().getTime()
|
||||
) {
|
||||
verifiedPayload = new DisbursementJwtPayloadType(
|
||||
jwtPayload.sendercommunityuuid as string,
|
||||
@ -265,7 +269,10 @@ export class TransactionLinkResolver {
|
||||
)
|
||||
return disbursementLink
|
||||
} else {
|
||||
throw new LogError('Redeem with wrong type of JWT-Token! decodedPayload=', decodedPayload)
|
||||
throw new LogError(
|
||||
'Redeem with wrong type of JWT-Token or expired! decodedPayload=',
|
||||
decodedPayload,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user