From 761d8d1c03094bd0fc206f9aaabe9f8a804caa32 Mon Sep 17 00:00:00 2001 From: Harvey Tindall Date: Wed, 21 Jun 2023 17:07:02 +0100 Subject: [PATCH] userpage: refresh pin when contact changed > once --- ts/modules/account-linking.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ts/modules/account-linking.ts b/ts/modules/account-linking.ts index ea3994f..45b1311 100644 --- a/ts/modules/account-linking.ts +++ b/ts/modules/account-linking.ts @@ -59,6 +59,7 @@ export class ServiceLinker { protected _waiting: HTMLSpanElement; protected _verified = false; protected _name: string; + protected _pin: string; get verified(): boolean { return this._verified; } @@ -76,7 +77,7 @@ export class ServiceLinker { setTimeout(this._checkVerified, 1500); return; } - _get(this._conf.verifiedURL + this._conf.pin, null, (req: XMLHttpRequest) => { + _get(this._conf.verifiedURL + this._pin, null, (req: XMLHttpRequest) => { if (req.readyState != 4) return; if (req.status == 401) { this._conf.modal.close(); @@ -111,14 +112,16 @@ export class ServiceLinker { toggleLoader(this._waiting); this._pinAcquired = false; + this._pin = ""; if (this._conf.pin) { this._pinAcquired = true; - this._conf.modal.modal.querySelector(".pin").textContent = this._conf.pin; + this._pin = this._conf.pin; + this._conf.modal.modal.querySelector(".pin").textContent = this._pin; } else if (this._conf.pinURL) { _get(this._conf.pinURL, null, (req: XMLHttpRequest) => { if (req.readyState == 4 && req.status == 200) { - this._conf.pin = req.response["pin"]; - this._conf.modal.modal.querySelector(".pin").textContent = this._conf.pin; + this._pin = req.response["pin"]; + this._conf.modal.modal.querySelector(".pin").textContent = this._pin; this._pinAcquired = true; } });