Skip to content

Commit

Permalink
Forgot password page (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
aivve committed Feb 13, 2022
1 parent 0935f78 commit 03e8d58
Show file tree
Hide file tree
Showing 21 changed files with 245 additions and 31 deletions.
1 change: 1 addition & 0 deletions src/model/AppState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ export class AppState {
showCancelButton: true,
confirmButtonText: i18n.t('global.openWalletModal.confirmText'),
cancelButtonText: i18n.t('global.openWalletModal.cancelText'),
html:`<a href="#!forgotPassword"><small>`+i18n.t('global.openWalletModal.forgotPassword')+`</small></a>`
}).then((result: any) => {
setTimeout(function () { //for async
if (result.value) {
Expand Down
44 changes: 44 additions & 0 deletions src/model/DeleteWallet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright (c) 2018, Gnock
* Copyright (c) 2018, The Masari Project
* Copyright (c) 2022, The Karbo developers
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

import {WalletRepository} from "../model/WalletRepository";
import {DependencyInjectorInstance} from "../lib/numbersLab/DependencyInjector";
import {Wallet} from "../model/Wallet";
import {AppState} from "../model/AppState";
import {Storage} from "../model/Storage";
import {Translations} from "../model/Translations";

export class DeleteWallet{
public static deleteWallet() {
//localStorage.clear();
//window.location.href = '/';
swal({
title: i18n.t('settingsPage.deleteWalletModal.title'),
html: i18n.t('settingsPage.deleteWalletModal.content'),
showCancelButton: true,
confirmButtonText: i18n.t('settingsPage.deleteWalletModal.confirmText'),
cancelButtonText: i18n.t('settingsPage.deleteWalletModal.cancelText'),
type: 'warning'
}).then((result:any) => {
if (result.value) {
AppState.disconnect();
DependencyInjectorInstance().register(Wallet.name, undefined,'default');
WalletRepository.deleteLocalCopy();
window.location.href = '#index';
}
});
}
}
21 changes: 21 additions & 0 deletions src/pages/forgotPassword.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<div id="app" class="body-root" v-cloak="">
<div class="body-header" >
<div class="header-title">
{{ $t("global.openWalletModal.forgotPassword") }}
</div>
<div class="header-subtitle" >
{{ $t("forgotPasswordPage.subtitle") }}
</div>
</div>
<div class="body-content" >
<div class="panel">
<div class="body" >
<div class="header-title" >{{ $t("forgotPasswordPage.forgotPasswordBlock.title") }}</div>
<div class="content" v-html="$t('forgotPasswordPage.forgotPasswordBlock.content')"></div>
<div class="actions tc">
<button class="btn red" @click="deleteWallet()" >{{ $t("settingsPage.deleteWalletButton") }}</button>
</div>
</div>
</div>
</div>
</div>
41 changes: 41 additions & 0 deletions src/pages/forgotPassword.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright (c) 2018, Gnock
* Copyright (c) 2018, The Masari Project
* Copyright (c) 2022, The Karbo developers
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import {DestructableView} from "../lib/numbersLab/DestructableView";
import {VueVar, VueWatched} from "../lib/numbersLab/VueAnnotate";
import {WalletRepository} from "../model/WalletRepository";
import {DependencyInjectorInstance} from "../lib/numbersLab/DependencyInjector";
import {Wallet} from "../model/Wallet";
import {AppState} from "../model/AppState";
import {Storage} from "../model/Storage";
import {Translations} from "../model/Translations";
import {DeleteWallet} from "../model/DeleteWallet";

AppState.enableLeftMenu();

class ForgotPasswordView extends DestructableView{
constructor(container : string){
super(container);
let self = this;
}

deleteWallet() {
//localStorage.clear();
//window.location.href = '/';
DeleteWallet.deleteWallet();
}
}

new ForgotPasswordView('#app');
2 changes: 1 addition & 1 deletion src/pages/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
<div class="panel">
<div class="body" >
<div class="content tc" >
<button class="btn" @click="deleteWallet()" >{{ $t("settingsPage.deleteWalletButton") }}</button>
<button class="btn red" @click="deleteWallet()" >{{ $t("settingsPage.deleteWalletButton") }}</button>
</div>
</div>
</div>
Expand Down
16 changes: 2 additions & 14 deletions src/pages/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {Translations} from "../model/Translations";
import {BlockchainExplorerProvider} from "../providers/BlockchainExplorerProvider";
import {BlockchainExplorer} from "../model/blockchain/BlockchainExplorer";
import {WalletWatchdog} from "../model/WalletWatchdog";
import {DeleteWallet} from "../model/DeleteWallet";

let wallet : Wallet = DependencyInjectorInstance().getInstance(Wallet.name, 'default', false);
let blockchainExplorer: BlockchainExplorer = BlockchainExplorerProvider.getInstance();
Expand Down Expand Up @@ -84,20 +85,7 @@ class SettingsView extends DestructableView{
}

deleteWallet() {
swal({
title: i18n.t('settingsPage.deleteWalletModal.title'),
html: i18n.t('settingsPage.deleteWalletModal.content'),
showCancelButton: true,
confirmButtonText: i18n.t('settingsPage.deleteWalletModal.confirmText'),
cancelButtonText: i18n.t('settingsPage.deleteWalletModal.cancelText'),
}).then((result:any) => {
if (result.value) {
AppState.disconnect();
DependencyInjectorInstance().register(Wallet.name, undefined,'default');
WalletRepository.deleteLocalCopy();
window.location.href = '#index';
}
});
DeleteWallet.deleteWallet();
}

@VueWatched() readSpeedWatch(){this.updateWalletOptions();}
Expand Down
11 changes: 9 additions & 2 deletions src/pages/support.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
{{ $t("supportPage.subtitle") }}
</div>
</div>
<div class="body-content" >
<div class="body-content">
<div class="panel">
<div class="body" >
<div class="body">
<div class="header-title" >{{ $t("supportPage.getInTouchBlock.title") }}</div>
<div class="content" >
<p>{{ $t("supportPage.getInTouchBlock.content") }}</p>
Expand All @@ -22,5 +22,12 @@
</div>
</div>
</div>
<div class="panel">
<div class="body">
<div class="content tc">
<a href="#!forgotPassword" class="btn">{{ $t("global.openWalletModal.forgotPassword") }}</a>
</div>
</div>
</div>
</div>
</div>
10 changes: 9 additions & 1 deletion src/translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
"openWalletModal":{
"title":"Wallet Passwort",
"confirmText":"Öffnen",
"cancelText":"Abbrechen"
"cancelText":"Abbrechen",
"forgotPassword": "Passwort vergessen?"
},
"invalidPasswordModal":{
"title":"Uups...",
Expand Down Expand Up @@ -191,6 +192,13 @@
"discord":"Karbo Discord Channel"
}
},
"forgotPasswordPage":{
"subtitle":"So stellen Sie den Zugriff auf Ihre Brieftasche wieder her",
"forgotPasswordBlock":{
"title":"Wenn Sie das Passwort vergessen haben, können Sie es nicht zurücksetzen!",
"content":"Die einzige Möglichkeit, den Zugriff auf Ihre Brieftasche wiederherzustellen, besteht darin, Ihr Passwort abzurufen oder Brieftaschendaten aus dem Speicher Ihres Browsers zu löschen und die Brieftasche aus dem Backup wiederherzustellen (z. B. mnemonische Wiederherstellungsphrase).<br /> Wenn Sie Brieftaschenschlüssel oder eine Wiederherstellungsphrase haben , unten können Sie Ihre Brieftasche löschen. Dann können Sie es wiederherstellen und von Grund auf neu synchronisieren.<br/> <strong>Bitte stellen Sie sicher, dass Sie einen Wiederherstellungssatz haben, bevor Sie fortfahren!!!</strong>"
}
},
"networkPage":{
"title":"Netzwerkstatus",
"subtitle":"Einblick ins Marsir Netzwerk",
Expand Down
10 changes: 9 additions & 1 deletion src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
"openWalletModal":{
"title":"Wallet Password",
"confirmText":"Open",
"cancelText":"Cancel"
"cancelText":"Cancel",
"forgotPassword": "Forgot password?"
},
"invalidPasswordModal":{
"title":"Oops...",
Expand Down Expand Up @@ -191,6 +192,13 @@
"discord":"Karbo Discord Channel"
}
},
"forgotPasswordPage":{
"subtitle":"How to restore access to your wallet",
"forgotPasswordBlock":{
"title":"If you forgot the password, it is impossible to reset it!",
"content":"The only way to get back into your wallet is to recall your password or to delete wallet data from your browser's memory and restore it from the backup (e.g. mnemonic recovery phrase).<br /> If you have wallet keys or a recovery phrase, below you can delete your wallet. Then you will be able to restore it and sync from scratch.<br/> <strong>Please, make sure you have recovery phrase before you proceed!!!</strong>"
}
},
"networkPage":{
"title":"Network stats",
"subtitle":"Insights on the Karbo network",
Expand Down
10 changes: 9 additions & 1 deletion src/translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
"openWalletModal": {
"title": "Contraseña de billetera",
"confirmText": "Abrir",
"cancelText": "Cancelar"
"cancelText": "Cancelar",
"forgotPassword": "¿Se te olvidó tu contraseña?"
},
"invalidPasswordModal": {
"title": "Oops...",
Expand Down Expand Up @@ -193,6 +194,13 @@
"discord": "Canal de Karbo en Discord"
}
},
"forgotPasswordPage":{
"subtitle":"Cómo restaurar el acceso a su billetera",
"forgotPasswordBlock":{
"title":"Si olvidó la contraseña, ¡es imposible restablecerla!",
"content":"La única forma de restaurar el acceso a su billetera es recordar su contraseña o eliminar los datos de la billetera de la memoria de su navegador y restaurar la billetera desde la copia de seguridad (por ejemplo, frase de recuperación mnemotécnica).<br /> Si tiene claves de billetera o una frase de recuperación , a continuación puede eliminar su billetera. Luego podrá restaurarlo y sincronizarlo desde cero.<br/> <strong>Por favor, ¡asegúrese de tener una frase de recuperación antes de continuar!</strong>"
}
},
"networkPage": {
"title": "Estado de red",
"subtitle": "Perspectivas sobre la red Karbo",
Expand Down
10 changes: 9 additions & 1 deletion src/translations/fa.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
"openWalletModal": {
"title": "'رمز عبور کیف پول'",
"confirmText": "تایید",
"cancelText": "لغو"
"cancelText": "لغو",
"forgotPassword": "رمز عبور را فراموش کرده اید؟"
},
"invalidPasswordModal": {
"title": "متاسفیم",
Expand Down Expand Up @@ -190,6 +191,13 @@
"discord": "سرور دیسکورد کربو"
}
},
"forgotPasswordPage":{
"subtitle":"نحوه بازیابی دسترسی به کیف پول",
"forgotPasswordBlock":{
"title":"اگر رمز عبور را فراموش کرده اید، تنظیم مجدد آن غیرممکن است!",
"content":"تنها راه برای بازگرداندن دسترسی به کیف پول شما این است که رمز عبور خود را فراخوانی کنید یا داده های کیف پول را از حافظه مرورگر خود حذف کنید و کیف پول را از نسخه پشتیبان بازیابی کنید (به عنوان مثال عبارت بازیابی حافظه).<br /> اگر کلیدهای کیف پول یا عبارت بازیابی دارید. ، در زیر می توانید کیف پول خود را حذف کنید. سپس می‌توانید آن را بازیابی و از ابتدا همگام‌سازی کنید.<br/> <strong>لطفاً قبل از ادامه، از داشتن عبارت بازیابی مطمئن شوید!!!</strong>"
}
},
"networkPage": {
"title": "وضعیت شبکه",
"subtitle": "داخل شبکه ی کربو",
Expand Down
10 changes: 9 additions & 1 deletion src/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
"openWalletModal":{
"title":"Mot de passe",
"confirmText":"Ouvrir",
"cancelText":"Annuler"
"cancelText":"Annuler",
"forgotPassword": "Mot de passe oublié?"
},
"invalidPasswordModal":{
"title":"Oups...",
Expand Down Expand Up @@ -191,6 +192,13 @@
"discord":"Discord Officiel de Karbo"
}
},
"forgotPasswordPage":{
"subtitle":"Comment restaurer l'accès à votre portefeuille",
"forgotPasswordBlock":{
"title":"Si vous avez oublié le mot de passe, il est impossible de le réinitialiser !",
"content":"La seule façon de restaurer l'accès à votre portefeuille est de rappeler votre mot de passe ou de supprimer les données du portefeuille de la mémoire de votre navigateur et de restaurer le portefeuille à partir de la sauvegarde (par exemple, une phrase de récupération mnémonique).<br /> Si vous avez des clés de portefeuille ou une phrase de récupération , ci-dessous vous pouvez supprimer votre portefeuille. Ensuite, vous pourrez le restaurer et le synchroniser à partir de zéro.<br/> <strong>Veuillez vous assurer d'avoir une phrase de récupération avant de continuer !!!</strong>"
}
},
"networkPage":{
"title":"Statistiques du réseau",
"subtitle":"Détails sur le réseaux Karbo",
Expand Down
10 changes: 9 additions & 1 deletion src/translations/gr.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
"openWalletModal":{
"title":"Κωδικός Πορτοφολιού",
"confirmText":"Άνοιγμα",
"cancelText":"Ακύρωση"
"cancelText":"Ακύρωση",
"forgotPassword": "Ξεχάσατε τον κωδικό?"
},
"invalidPasswordModal":{
"title":"Ουπς...",
Expand Down Expand Up @@ -191,6 +192,13 @@
"discord":"Karbo Discord Channel"
}
},
"forgotPasswordPage":{
"subtitle":"Πώς να επαναφέρετε την πρόσβαση στο πορτοφόλι σας",
"forgotPasswordBlock":{
"title":"Εάν ξεχάσατε τον κωδικό πρόσβασης, είναι αδύνατο να τον επαναφέρετε!",
"content":"Ο μόνος τρόπος για να επαναφέρετε την πρόσβαση στο πορτοφόλι σας είναι να ανακαλέσετε τον κωδικό πρόσβασής σας ή να διαγράψετε τα δεδομένα του πορτοφολιού από τη μνήμη του προγράμματος περιήγησής σας και να επαναφέρετε το πορτοφόλι από το αντίγραφο ασφαλείας (π.χ. μνημονική φράση ανάκτησης).<br /> Εάν έχετε κλειδιά πορτοφολιού ή μια φράση ανάκτησης , παρακάτω μπορείτε να διαγράψετε το πορτοφόλι σας. Στη συνέχεια, θα μπορείτε να το επαναφέρετε και να συγχρονίσετε από την αρχή.<br/> <strong>Βεβαιωθείτε ότι έχετε μια φράση ανάκτησης προτού προχωρήσετε!!!</strong>"
}
},
"networkPage":{
"title":"Στατιστικά Δικτύου΄",
"subtitle":"Επισκόπηση τπυ δικτύου Karbo",
Expand Down
10 changes: 9 additions & 1 deletion src/translations/hu.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
"openWalletModal":{
"title":"Tárca jelszava",
"confirmText":"Megnyitás",
"cancelText":"Mégsem"
"cancelText":"Mégsem",
"forgotPassword": "Elfelejtetted a jelszavad?"
},
"invalidPasswordModal":{
"title":"Hupsz...",
Expand Down Expand Up @@ -191,6 +192,13 @@
"discord":"Karbo Discord-csatorna"
}
},
"forgotPasswordPage":{
"subtitle":"Hogyan lehet visszaállítani a hozzáférést a pénztárcájához",
"forgotPasswordBlock":{
"title":"Ha elfelejtette a jelszót, azt lehetetlen visszaállítani!",
"content":"A pénztárcájához való hozzáférés visszaállításának egyetlen módja, ha előhívja jelszavát, vagy törli a pénztárca adatait a böngésző memóriájából, és visszaállítja a pénztárcát a biztonsági másolatból (pl. mnemonikus helyreállítási kifejezés).<br /> Ha rendelkezik pénztárcakulcsokkal vagy helyreállítási kifejezéssel. , lent törölheti pénztárcáját. Ezután visszaállíthatja és a semmiből szinkronizálhatja.<br/> <strong>Kérjük, győződjön meg róla, hogy rendelkezik helyreállítási kifejezéssel, mielőtt továbblép!!!</strong>"
}
},
"networkPage":{
"title":"Hálózati statisztika",
"subtitle":"Betekintés a Karbo hálózatába",
Expand Down
10 changes: 9 additions & 1 deletion src/translations/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"openWalletModal":{
"title":"Password portafoglio",
"confirmText":"Apri",
"cancelText":"Annulla"
"cancelText":"Annulla",
"forgotPassword": "Ha dimenticato la password?"
},
"invalidPasswordModal":{
"title":"Oops...",
Expand Down Expand Up @@ -190,6 +191,13 @@
"discord":"Karbo Discord Channel"
}
},
"forgotPasswordPage":{
"subtitle":"Come ripristinare l'accesso al tuo portafoglio",
"forgotPasswordBlock":{
"title":"Se hai dimenticato la password, è impossibile reimpostarla!",
"content":"L'unico modo per ripristinare l'accesso al tuo portafoglio è richiamare la tua password o eliminare i dati del portafoglio dalla memoria del browser e ripristinare il portafoglio dal backup (ad es. frase mnemonica di ripristino).<br /> Se disponi delle chiavi del portafoglio o di una frase di ripristino. , di seguito puoi eliminare il tuo portafoglio. Quindi sarai in grado di ripristinarlo e sincronizzarlo da zero.<br/> <strong>Per favore, assicurati di avere una frase di ripristino prima di procedere!!!</strong>"
}
},
"networkPage":{
"title":"Statistiche del network",
"subtitle":"Dettagli sul network Karbo",
Expand Down
Loading

0 comments on commit 03e8d58

Please sign in to comment.