commit
677253b0dc
7 changed files with 451 additions and 184 deletions
|
|
@ -1,133 +1,228 @@
|
|||
<div
|
||||
class="topbar-container"
|
||||
ng-include="'views/includes/topbar.html'"
|
||||
ng-init="titleSection='Backup'; goBackToState = 'preferences'">
|
||||
</div>
|
||||
<div class="backup" ng-controller="backupController as wordsC">
|
||||
<nav class="tab-bar">
|
||||
<section class="left-small" ng-show="(wordsC.step != 1 && wordsC.step != 4)">
|
||||
<a ng-click="wordsC.goToStep(1);">
|
||||
<i class="icon-arrow-left3 icon-back"></i>
|
||||
</a>
|
||||
</section>
|
||||
|
||||
<section class="middle tab-bar-section">
|
||||
</section>
|
||||
|
||||
<div class="content preferences" ng-controller="wordsController as wordsC">
|
||||
<h4></h4>
|
||||
|
||||
<div class="box-notification" ng-show="wordsC.error">
|
||||
<span class="text-warning">
|
||||
{{wordsC.error|translate}}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div ng-show="wordsC.mnemonicWords || (wordsC.credentialsEncrypted && !wordsC.deleted)">
|
||||
<div class="row" ng-show="index.n==1">
|
||||
<div class="m10t columns size-14 text-gray">
|
||||
<span translate>
|
||||
You need the wallet seed to restore this personal wallet.
|
||||
<section class="right-small">
|
||||
<a class="p10" ng-click="$root.go(index.prevState);">
|
||||
<span class="text-close">
|
||||
<i class="fi-x size-24"></i>
|
||||
</span>
|
||||
<span translate class="text-bold">
|
||||
Write it down and keep them somewhere safe.
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" ng-show="(index.n>1 && index.m != index.n )">
|
||||
<div class="m10t columns size-14 text-gray">
|
||||
<span translate>
|
||||
To restore this {{index.m}}-{{index.n}} <b>shared</b> wallet you will need
|
||||
</span>:
|
||||
<ol class="m10t columns size-14 text-gray">
|
||||
<li translate>Your wallet seed and access to the server that coordinated the initial wallet creation. You still need {{index.m}} keys to spend.</li>
|
||||
<li translate><b>OR</b> the wallet seed of <b>all</b> copayers in the wallet</li>
|
||||
<li translate><b>OR</b> 1 wallet export file and the remaining quorum of wallet seeds (e.g. in a 3-5 wallet: 1 wallet export file + 2 wallet seeds of any of the other copayers).</li>
|
||||
</ol>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" ng-show="(index.n>1 && index.m == index.n )">
|
||||
<div class="m10t columns size-14 text-gray">
|
||||
<span translate>
|
||||
To restore this {{index.m}}-{{index.n}} <b>shared</b> wallet you will need
|
||||
</span>:
|
||||
<ol class="m10t columns size-14 text-gray">
|
||||
<li translate>Your wallet seed and access to the server that coordinated the initial wallet creation. You still need {{index.m}} keys to spend.</li>
|
||||
<li translate><b>OR</b> the wallet seeds of <b>all</b> copayers in the wallet</li>
|
||||
</ol>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</section>
|
||||
</nav>
|
||||
|
||||
<div class="row m20t" ng-show="wordsC.deleted">
|
||||
<div class="columns size-14 text-gray text-center" translate>
|
||||
Wallet seed not available. You can still export it from Advanced > Export.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-show="wordsC.mnemonicWords || (wordsC.credentialsEncrypted && !wordsC.deleted)">
|
||||
<div class="row">
|
||||
<div class="m10t columns">
|
||||
<a class="button outline light-gray expand tiny" ng-click="wordsC.toggle()">
|
||||
<i class="fi-widget m3r"></i>
|
||||
<span translate ng-hide="wordsC.show">Show Wallet Seed</span>
|
||||
<span translate ng-hide="!wordsC.show">Hide Wallet Seed</span>
|
||||
<i ng-if="!wordsC.show" class="icon-arrow-down4"></i>
|
||||
<i ng-if="wordsC.show" class="icon-arrow-up4"></i>
|
||||
</a>
|
||||
</div>
|
||||
<div class="content preferences">
|
||||
<div class="box-notification" ng-show="wordsC.error">
|
||||
<span class="text-warning" translate>
|
||||
{{wordsC.error}}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
## STEP 1
|
||||
-->
|
||||
|
||||
<div class="row m10t m10b" ng-show="wordsC.show">
|
||||
<div class="small-centered text-gray columns size-14 text-center" translate>
|
||||
Your Wallet Seed
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" ng-show="wordsC.show">
|
||||
<div class="columns">
|
||||
<div class="p10" style="background:white" ng-class="{'enable_text_select': index.network == 'testnet'}">
|
||||
<span ng-repeat="word in wordsC.mnemonicWords track by $index"><span style="white-space:nowrap">{{word}}</span><span ng-show="wordsC.useIdeograms"> </span> </span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row m10t m20b" ng-show="wordsC.show">
|
||||
<div class="columns" ng-show="wordsC.mnemonicHasPassphrase">
|
||||
<span class="size-12">
|
||||
<i class="fi-alert"></i>
|
||||
<span translate>
|
||||
WARNING: This seed was created with a passphrase. To recover this wallet both the mnemonic and passphrase are needed.
|
||||
</span>
|
||||
<div ng-show="wordsC.step == 1">
|
||||
<div ng-show="wordsC.mnemonicWords || (wordsC.credentialsEncrypted && !wordsC.deleted)">
|
||||
<h5 class="text-center">Write your wallet seed</h5>
|
||||
<div class="size-14 text-gray" ng-show="(index.n>1 && index.m != index.n )">
|
||||
<span translate>
|
||||
To restore this {{index.m}}-{{index.n}} <b>shared</b> wallet you will need
|
||||
</span>:
|
||||
<ol class="m10t columns size-14 text-gray">
|
||||
<li translate>Your wallet seed and access to the server that coordinated the initial wallet creation. You still need {{index.m}} keys to spend.</li>
|
||||
<li translate><b>OR</b> the wallet seed of <b>all</b> copayers in the wallet</li>
|
||||
<li translate><b>OR</b> 1 wallet export file and the remaining quorum of wallet seeds (e.g. in a 3-5 wallet: 1 wallet export file + 2 wallet seeds of any of the other copayers).</li>
|
||||
</ol>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="size-14 text-gray" ng-show="(index.n>1 && index.m == index.n )">
|
||||
<span translate>
|
||||
To restore this {{index.m}}-{{index.n}} <b>shared</b> wallet you will need
|
||||
</span>:
|
||||
<ol class="m10t columns size-14 text-gray">
|
||||
<li translate>Your wallet seed and access to the server that coordinated the initial wallet creation. You still need {{index.m}} keys to spend.</li>
|
||||
<li translate><b>OR</b> the wallet seeds of <b>all</b> copayers in the wallet</li>
|
||||
</ol>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" ng-show="wordsC.show">
|
||||
<div class="m10t text-center columns">
|
||||
<div class="size-12 text-gray">
|
||||
<span translate>
|
||||
Once you have copied your wallet seed down, it is recommended to delete it from this device.
|
||||
</span>
|
||||
<div class="row m20t" ng-show="wordsC.deleted">
|
||||
<div class="columns size-14 text-gray text-center" translate>
|
||||
Wallet seed not available. You can still export it from Advanced > Export.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-show="wordsC.mnemonicWords || (wordsC.credentialsEncrypted && !wordsC.deleted)">
|
||||
<p class="text-center columns text-gray" ng-show="index.n==1 && wordsC.step == 1">
|
||||
<span translate>
|
||||
You need the wallet seed to restore this personal wallet. Write it down and keep them somewhere safe.
|
||||
</span>
|
||||
</p>
|
||||
<div class="row" ng-show="wordsC.credentialsEncrypted">
|
||||
<div class="m10t columns">
|
||||
<a class="button outline light-gray expand tiny" ng-click="wordsC.toggle()">
|
||||
<i class="fi-widget m3r"></i>
|
||||
<span translate ng-hide="wordsC.show">Show Wallet Seed</span>
|
||||
</a>
|
||||
</div>
|
||||
<button class="button outline m10t round dark-gray tiny" ng-click="wordsC.delete()">
|
||||
<i class="fi-trash"></i>
|
||||
<span translate>
|
||||
DELETE WORDS
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" ng-show="!wordsC.credentialsEncrypted">
|
||||
<div class="columns">
|
||||
<div class="panel" ng-class="{'enable_text_select': index.network == 'testnet'}">
|
||||
<span ng-repeat="word in wordsC.mnemonicWords track by $index"><span style="white-space:nowrap">{{word}}</span><span ng-show="wordsC.useIdeograms"> </span> </span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- hide this in multisig just to show less text -->
|
||||
<div class="row m20t" ng-show="index.n==1">
|
||||
<div class="columns size-12 text-gray">
|
||||
<div class="p10t" style="border-top:1px solid #ccc">
|
||||
<span translate>You can safely install your wallet on another device and use it from multiple devices at the same time.</span>
|
||||
<a href="#" ng-click="$root.openExternalLink('https://github.com/bitpay/copay/blob/master/README.md#copay-backups-and-recovery')" translate>
|
||||
Learn more about Copay backups
|
||||
</a>
|
||||
<div class="columns extra-padding-bottom" ng-show="!wordsC.credentialsEncrypted">
|
||||
<div class="line-t p10 size-10 text-gray text-center" ng-show="wordsC.mnemonicHasPassphrase">
|
||||
<i class="fi-alert"></i>
|
||||
<span translate>
|
||||
This seed was created with a passphrase. To recover this wallet both the mnemonic and passphrase are needed.
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="button-box">
|
||||
<button
|
||||
ng-show="!wordsC.deleted"
|
||||
ng-disabled="wordsC.credentialsEncrypted"
|
||||
class="round expand m0"
|
||||
ng-style="{'background-color':index.backgroundColor}"
|
||||
ng-click="wordsC.goToStep(2);"
|
||||
translate>Continue
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!--
|
||||
## STEP 2
|
||||
-->
|
||||
|
||||
<div ng-show="wordsC.step == 2">
|
||||
<div class="columns text-center extra-padding-bottom">
|
||||
<h5>Confirm your wallet seed</h5>
|
||||
<p class="text-gray m0">
|
||||
Please tap the words in order to confirm your backup phrase is correctly written.
|
||||
</p>
|
||||
<div class="panel words text-left" ng-class="{'enable_text_select': index.network == 'testnet'}">
|
||||
<div id="addWord"></div>
|
||||
</div>
|
||||
<div class="text-left" ng-class="{'enable_text_select': index.network == 'testnet'}" id="buttons">
|
||||
<span ng-repeat="word in wordsC.shuffledMnemonicWords track by $index">
|
||||
<button class="button radius tiny words" ng-if="$index > 9" ng-click="wordsC.disableButton($index, word)" id="{{$index + word}}">{{word}}</button>
|
||||
<button class="button radius tiny words" ng-if="$index <= 9" ng-click="wordsC.disableButton('0' + $index, word)" id="{{'0' + $index + word}}">{{word}}</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="button-box">
|
||||
<button
|
||||
ng-disabled="!wordsC.selectComplete"
|
||||
class="round expand m0"
|
||||
ng-style="{'background-color':index.backgroundColor}"
|
||||
ng-click="wordsC.goToStep(3);"
|
||||
translate>Continue
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
## STEP 3
|
||||
-->
|
||||
|
||||
<div ng-show="wordsC.step == 3">
|
||||
<div class="columns text-center">
|
||||
<h5> Enter your passphrase</h5>
|
||||
<p class="text-gray m0">
|
||||
In order to verify your wallet backup, please type your passphrase:
|
||||
</p>
|
||||
<div class="m20v">
|
||||
<input type="text" id="passphrase" ng-model="passphrase" autocapitalize="off" spellcheck="false" autofocus/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="button-box">
|
||||
<button
|
||||
ng-disabled="!passphrase"
|
||||
ng-style="{'background-color':index.backgroundColor}"
|
||||
class="button round expand m0"
|
||||
ng-click="wordsC.goToStep(4);"
|
||||
translate>Continue
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
## STEP 4
|
||||
-->
|
||||
|
||||
<div ng-show="wordsC.step == 4">
|
||||
<div class="row m10t m10b text-center" ng-show="!wordsC.backupError">
|
||||
<div class="circle-icon">
|
||||
<i class="fi-like size-48"></i>
|
||||
</div>
|
||||
<h5>Congratulation</h5>
|
||||
<p class="text-gray columns" translate>
|
||||
You backed up your new wallet. You can now restore this wallet at any time
|
||||
</p>
|
||||
|
||||
<div class="columns text-center m20t">
|
||||
<button
|
||||
ng-style="{'background-color':index.backgroundColor}"
|
||||
class="button round expand"
|
||||
ng-click="$root.go('walletHome');"
|
||||
translate>Finish
|
||||
</button>
|
||||
<!-- hide this in multisig just to show less text -->
|
||||
<div class="row m20t" ng-show="index.n==1">
|
||||
<div class="columns size-10 text-gray">
|
||||
<div class="p10t line-t">
|
||||
<span translate>You can safely install your wallet on another device and use it from multiple devices at the same time.</span>
|
||||
<a href="#" ng-click="$root.openExternalLink('https://github.com/bitpay/copay/blob/master/README.md#copay-backups-and-recovery')" translate>
|
||||
Learn more about Copay backups
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m10t m10b text-center" ng-show="wordsC.backupError">
|
||||
<div class="circle-icon">
|
||||
<i class="fi-dislike size-48"></i>
|
||||
</div>Backup failed</h5>
|
||||
<p class="text-gray columns" translate>
|
||||
Failed to verify backup. Please check your information
|
||||
</p>
|
||||
<div class="columns size-10 text-gray extra-padding-bottom" ng-show="index.n==1">
|
||||
<div class="p10t line-t">
|
||||
<span translate>You can safely install your wallet on another device and use it from multiple devices at the same time.</span>
|
||||
<a href="#" ng-click="$root.openExternalLink('https://github.com/bitpay/copay/blob/master/README.md#copay-backups-and-recovery')" translate>
|
||||
Learn more about Copay backups
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="button-box">
|
||||
<button
|
||||
ng-style="{'background-color':index.backgroundColor}"
|
||||
class="button round expand m0"
|
||||
ng-click="wordsC.goToStep(1);"
|
||||
translate>Try again
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="extra-margin-bottom"></div>
|
||||
|
|
|
|||
|
|
@ -6,17 +6,17 @@
|
|||
|
||||
|
||||
|
||||
<div class="content preferences" ng-controller="backupController as backup">
|
||||
<div class="content preferences" ng-controller="exportController as exportC">
|
||||
<h4></h4>
|
||||
<div ng-show="!backup.backupWalletPlainText">
|
||||
<div class="text-warning size-14 m20b" ng-show="backup.error">
|
||||
<div ng-show="!exportC.backupWalletPlainText">
|
||||
<div class="text-warning size-14 m20b" ng-show="exportC.error">
|
||||
<i class="fi-alert size-12"></i>
|
||||
<span translate> Failed to export </span>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="columns">
|
||||
<div class="text-warning size-14 m20b" ng-show="backup.isEncrypted">
|
||||
<div class="text-warning size-14 m20b" ng-show="exportC.isEncrypted">
|
||||
<i class="fi-alert size-12"></i>
|
||||
<span translate> The private key for this wallet is encrypted. Exporting keep the private key encrypted in the export archive.</span>
|
||||
|
||||
|
|
@ -31,14 +31,14 @@
|
|||
<div class="input">
|
||||
<input type="password" class="form-control"
|
||||
placeholder="{{'Your export password'|translate}}"
|
||||
name="password" ng-model="backup.password">
|
||||
name="password" ng-model="exportC.password">
|
||||
</div>
|
||||
|
||||
<label for="password" translate>Repeat password</label>
|
||||
<div class="input">
|
||||
<input type="password" class="form-control"
|
||||
placeholder="{{'Repeat password'|translate}}"
|
||||
name="password" ng-model="backup.repeatpassword">
|
||||
name="password" ng-model="exportC.repeatpassword">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -83,25 +83,25 @@
|
|||
|
||||
<div class="row">
|
||||
<div class="columns">
|
||||
<button class="black round expand m20t" ng-click="backup.downloadWalletBackup()"
|
||||
ng-disabled="(!backup.password || backup.password != backup.repeatpassword)"
|
||||
<button class="black round expand m20t" ng-click="exportC.downloadWalletBackup()"
|
||||
ng-disabled="(!exportC.password || exportC.password != exportC.repeatpassword)"
|
||||
ng-style="{'background-color':index.backgroundColor}"
|
||||
ng-show="!index.isSafari && !index.isCordova"><i class="fi-download"></i>
|
||||
<span translate>Download</span></button>
|
||||
<button class="black round expand m20t" ng-click="backup.viewWalletBackup()"
|
||||
ng-disabled="(!backup.password || backup.password != backup.repeatpassword)"
|
||||
<button class="black round expand m20t" ng-click="exportC.viewWalletBackup()"
|
||||
ng-disabled="(!exportC.password || exportC.password != exportC.repeatpassword)"
|
||||
ng-style="{'background-color':index.backgroundColor}"
|
||||
ng-show="index.isSafari && !index.isCordova"><i class="fi-eye"></i>
|
||||
<span translate>View</span></button>
|
||||
<div ng-show="index.isCordova">
|
||||
<h4 translate>Export options</h4>
|
||||
<button class="black round expand" ng-disabled="(!backup.password || backup.password != backup.repeatpassword)"
|
||||
<button class="black round expand" ng-disabled="(!exportC.password || exportC.password != exportC.repeatpassword)"
|
||||
ng-style="{'background-color':index.backgroundColor}"
|
||||
ng-click="backup.copyWalletBackup()"><i class="fi-clipboard-pencil"></i>
|
||||
ng-click="exportC.copyWalletBackup()"><i class="fi-clipboard-pencil"></i>
|
||||
<span translate>Copy to clipboard</span></button>
|
||||
<button class="black round expand" ng-disabled="(!backup.password || backup.password != backup.repeatpassword)"
|
||||
<button class="black round expand" ng-disabled="(!exportC.password || exportC.password != exportC.repeatpassword)"
|
||||
ng-style="{'background-color':index.backgroundColor}"
|
||||
ng-click="backup.sendWalletBackup()"><i class="fi-mail"></i>
|
||||
ng-click="exportC.sendWalletBackup()"><i class="fi-mail"></i>
|
||||
<span translate>Send by email</span></button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -109,11 +109,11 @@
|
|||
|
||||
</div>
|
||||
|
||||
<div class="row" ng-show="backup.backupWalletPlainText">
|
||||
<div class="row" ng-show="exportC.backupWalletPlainText">
|
||||
<div class="large-12 columns">
|
||||
<h3 translate>Wallet Export</h3>
|
||||
<div class="input">
|
||||
<textarea rows="12">{{backup.backupWalletPlainText}}</textarea>
|
||||
<textarea rows="12">{{exportC.backupWalletPlainText}}</textarea>
|
||||
</div>
|
||||
<div class="size-12 text-gray text-right">
|
||||
<i class="icon-compose"></i>
|
||||
|
|
|
|||
|
|
@ -182,23 +182,18 @@
|
|||
-->
|
||||
<div id="receive" class="receive tab-view">
|
||||
|
||||
<div ng-show="index.needsBackup" class="p60t row text-center">
|
||||
<div class="large-12 columns">
|
||||
<div class="text-warning text-bold m15b">
|
||||
<i class="fi-alert"></i>
|
||||
<span translate>
|
||||
WARNING: Backup needed
|
||||
</span>
|
||||
</div>
|
||||
<div class="text-gray" translate>
|
||||
Before receiving funds, it is highly recommended you backup your wallet keys.
|
||||
</div>
|
||||
|
||||
<button class="m20t button black expand round"
|
||||
ng-click="$root.go('backup')" ng-style="{'background-color':index.backgroundColor}" >
|
||||
<span translate>Backup now</span>
|
||||
</button>
|
||||
<div ng-show="index.needsBackup" class="p60t columns text-center">
|
||||
<div class="circle-icon">
|
||||
<i class="fi-alert size-48"></i>
|
||||
</div>
|
||||
<h5>Backup Needed</h5>
|
||||
<p class="text-gray m20b columns" translate>
|
||||
Before receiving funds, it is highly recommended you backup your wallet. If you lose this device, it is impossible to access your funds without a backup.
|
||||
</p>
|
||||
<button class="m20t button black expand round"
|
||||
ng-click="$root.go('backup')" ng-style="{'background-color':index.backgroundColor}" >
|
||||
<span translate>Backup now</span>
|
||||
</button>
|
||||
</div>
|
||||
<div ng-show="!index.needsBackup">
|
||||
<div class="row">
|
||||
|
|
@ -473,6 +468,14 @@
|
|||
<span translate>Transactions Downloaded</span>
|
||||
</div>
|
||||
</div>
|
||||
<div ng-show="index.txProgress > 6" translate class="size-12 text-gray m20t">
|
||||
Initial transaction history synchronization can take some minutes for wallets with many transactions.</br>
|
||||
Please stand by.
|
||||
</div>
|
||||
<div ng-show="index.txProgress > 6" class="size-14 text-gray m20t">
|
||||
<b>{{index.txProgress}}</b>
|
||||
<span translate>Transactions<br> Downloaded</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-show="index.txHistory[0]">
|
||||
|
|
@ -514,7 +517,7 @@
|
|||
<div class="size-14 text-gray columns m5t" ng-if="btx.message || btx.addressTo">
|
||||
<div ng-show="btx.message">{{btx.message}}</div>
|
||||
<div ng-show="!btx.message">
|
||||
{{index.addressbook[btx.addressTo] || btx.addressTo}}
|
||||
<span translate>To</span>: {{index.addressbook[btx.addressTo] || btx.addressTo}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -367,6 +367,55 @@ ul.tx-copayers {
|
|||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.receive .circle-icon {
|
||||
padding: 0.2rem;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.backup .circle-icon {
|
||||
background: #fff;
|
||||
padding: 0.2rem;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.receive h5, .backup h5 {
|
||||
font-weight: 500;
|
||||
color: #4B6178;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.receive p, .backup p {
|
||||
font-size: 0.9rem;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.backup .tab-bar {
|
||||
background: #f1f3f5;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.backup .button-box {
|
||||
background: #F1F3F5;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
padding: 0.5rem 1rem 1rem;
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
.backup input[type="text"] {
|
||||
border-bottom: 1px solid #CAD4DB;
|
||||
}
|
||||
|
||||
.backup input[type="text"]:focus {
|
||||
border-bottom: 1px solid #A5B2BF;
|
||||
}
|
||||
|
||||
.extra-padding-bottom {
|
||||
padding-bottom: 78px;
|
||||
}
|
||||
|
||||
.date-message {
|
||||
background-color: #213140;
|
||||
border-radius: 3px;
|
||||
|
|
@ -988,6 +1037,30 @@ input.ng-invalid-match, input.ng-invalid-match:focus {
|
|||
padding: 1rem;
|
||||
}
|
||||
|
||||
.panel.words {
|
||||
background: #E6EAEE;
|
||||
border: 1px dashed #A5B2BF;
|
||||
min-height: 147px;
|
||||
}
|
||||
|
||||
.backup .panel {
|
||||
padding: 0.5rem;
|
||||
}
|
||||
|
||||
.backup button.words {
|
||||
background: #FFFFFF;
|
||||
box-shadow: 0px 0px 4px 0px rgba(0,0,0,0.30);
|
||||
color: #4B6178;
|
||||
text-transform: lowercase;
|
||||
font-size: 0.8rem;
|
||||
margin: 5px;
|
||||
padding: 0.5rem;
|
||||
}
|
||||
|
||||
.backup button[disabled] {
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.panel qrcode {
|
||||
background-color: white;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,69 +1,73 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('wordsController',
|
||||
function($rootScope, $scope, $timeout, profileService, go, gettext, confirmDialog, notification, bwsError, $log) {
|
||||
angular.module('copayApp.controllers').controller('backupController',
|
||||
function($rootScope, $scope, $timeout, $log, $state, $compile, go, lodash, profileService, gettext, bwcService, bwsError) {
|
||||
|
||||
var msg = gettext('Are you sure you want to delete the backup words?');
|
||||
var successMsg = gettext('Backup words deleted');
|
||||
var self = this;
|
||||
self.show = false;
|
||||
var fc = profileService.focusedClient;
|
||||
var customWords = [];
|
||||
|
||||
if (fc.isPrivKeyEncrypted()) self.credentialsEncrypted = true;
|
||||
else {
|
||||
setWords(fc.getMnemonic());
|
||||
function init() {
|
||||
$scope.passphrase = '';
|
||||
resetAllButtons();
|
||||
customWords = [];
|
||||
self.step = 1;
|
||||
self.deleted = false;
|
||||
self.credentialsEncrypted = false;
|
||||
self.selectComplete = false;
|
||||
self.backupError = false;
|
||||
}
|
||||
if (fc.credentials && !fc.credentials.mnemonicEncrypted && !fc.credentials.mnemonic) {
|
||||
|
||||
init();
|
||||
|
||||
if (fc.credentials && !fc.credentials.mnemonicEncrypted && !fc.credentials.mnemonic)
|
||||
self.deleted = true;
|
||||
|
||||
if (fc.isPrivKeyEncrypted() && !self.deleted) {
|
||||
self.credentialsEncrypted = true;
|
||||
passwordRequest();
|
||||
} else {
|
||||
if (!self.deleted)
|
||||
initWords();
|
||||
}
|
||||
|
||||
self.goToStep = function(n) {
|
||||
self.step = n;
|
||||
if (self.step == 1)
|
||||
init();
|
||||
if (self.step == 3 && !self.mnemonicHasPassphrase)
|
||||
self.step++;
|
||||
if (self.step == 4) {
|
||||
confirm();
|
||||
}
|
||||
}
|
||||
|
||||
function initWords() {
|
||||
var words = fc.getMnemonic();
|
||||
self.xPrivKey = fc.credentials.xPrivKey;
|
||||
profileService.lockFC();
|
||||
self.mnemonicWords = words.split(/[\u3000\s]+/);
|
||||
self.shuffledMnemonicWords = lodash.sortBy(self.mnemonicWords);;
|
||||
self.mnemonicHasPassphrase = fc.mnemonicHasPassphrase();
|
||||
self.useIdeograms = words.indexOf("\u3000") >= 0;
|
||||
};
|
||||
|
||||
self.toggle = function() {
|
||||
self.error = "";
|
||||
if (!self.credentialsEncrypted) {
|
||||
if (!self.show)
|
||||
$rootScope.$emit('Local/BackupDone');
|
||||
self.show = !self.show;
|
||||
}
|
||||
|
||||
if (self.credentialsEncrypted)
|
||||
self.passwordRequest();
|
||||
passwordRequest();
|
||||
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
}, 1);
|
||||
};
|
||||
|
||||
self.delete = function() {
|
||||
confirmDialog.show(msg, function(ok) {
|
||||
if (ok) {
|
||||
fc.clearMnemonic();
|
||||
profileService.updateCredentialsFC(function() {
|
||||
self.deleted = true;
|
||||
notification.success(successMsg);
|
||||
go.walletHome();
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.$on('$destroy', function() {
|
||||
profileService.lockFC();
|
||||
});
|
||||
|
||||
function setWords(words) {
|
||||
if (words) {
|
||||
self.mnemonicWords = words.split(/[\u3000\s]+/);
|
||||
self.mnemonicHasPassphrase = fc.mnemonicHasPassphrase();
|
||||
self.useIdeograms = words.indexOf("\u3000") >= 0;
|
||||
}
|
||||
};
|
||||
|
||||
self.passwordRequest = function() {
|
||||
function passwordRequest() {
|
||||
try {
|
||||
setWords(fc.getMnemonic());
|
||||
initWords();
|
||||
} catch (e) {
|
||||
if (e.message && e.message.match(/encrypted/) && fc.isPrivKeyEncrypted()) {
|
||||
self.credentialsEncrypted = true;
|
||||
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
|
|
@ -75,13 +79,99 @@ angular.module('copayApp.controllers').controller('wordsController',
|
|||
$log.warn('Error decrypting credentials:', self.error); //TODO
|
||||
return;
|
||||
}
|
||||
if (!self.show && self.credentialsEncrypted)
|
||||
self.show = !self.show;
|
||||
|
||||
self.credentialsEncrypted = false;
|
||||
setWords(fc.getMnemonic());
|
||||
$rootScope.$emit('Local/BackupDone');
|
||||
initWords();
|
||||
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
}, 1);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function resetAllButtons() {
|
||||
document.getElementById('addWord').innerHTML = '';
|
||||
var nodes = document.getElementById("buttons").getElementsByTagName('button');
|
||||
lodash.each(nodes, function(n) {
|
||||
document.getElementById(n.id).disabled = false;
|
||||
});
|
||||
}
|
||||
|
||||
self.enableButton = function(word) {
|
||||
document.getElementById(word).disabled = false;
|
||||
lodash.remove(customWords, function(v) {
|
||||
return v == word;
|
||||
});
|
||||
}
|
||||
|
||||
self.disableButton = function(index, word) {
|
||||
var element = {
|
||||
index: index,
|
||||
word: word
|
||||
};
|
||||
document.getElementById(index + word).disabled = true;
|
||||
customWords.push(element);
|
||||
self.addButton(index, word);
|
||||
}
|
||||
|
||||
self.addButton = function(index, word) {
|
||||
var btnhtml = '<button class="button radius tiny words" ng-disabled="wordsC.disableButtons"' +
|
||||
'data-ng-click="wordsC.removeButton($event)" id="_' + index + word + '" > ' + word + ' </button>';
|
||||
var temp = $compile(btnhtml)($scope);
|
||||
angular.element(document.getElementById('addWord')).append(temp);
|
||||
self.shouldContinue();
|
||||
}
|
||||
|
||||
self.removeButton = function(event) {
|
||||
var id = (event.target.id);
|
||||
document.getElementById(id).remove();
|
||||
self.enableButton(id.substring(1));
|
||||
lodash.remove(customWords, function(d) {
|
||||
return d.index == id.substring(1, 3);
|
||||
});
|
||||
self.shouldContinue();
|
||||
}
|
||||
|
||||
self.shouldContinue = function() {
|
||||
if (customWords.length == 12)
|
||||
self.selectComplete = true;
|
||||
else
|
||||
self.selectComplete = false;
|
||||
}
|
||||
|
||||
function confirm() {
|
||||
self.backupError = false;
|
||||
|
||||
var walletClient = bwcService.getClient();
|
||||
var separator = self.useIdeograms ? '\u3000' : ' ';
|
||||
var customSentence = lodash.pluck(customWords, 'word').join(separator);
|
||||
var passphrase = $scope.passphrase || '';
|
||||
|
||||
try {
|
||||
walletClient.seedFromMnemonic(customSentence, {
|
||||
network: fc.credentials.network,
|
||||
passphrase: passphrase,
|
||||
account: fc.credentials.account
|
||||
})
|
||||
} catch (err) {
|
||||
return backupError(err);
|
||||
}
|
||||
|
||||
if (walletClient.credentials.xPrivKey != self.xPrivKey) {
|
||||
return backupError('Private key mismatch');
|
||||
}
|
||||
|
||||
$rootScope.$emit('Local/BackupDone');
|
||||
}
|
||||
|
||||
function backupError(err) {
|
||||
$log.debug('Failed to verify backup: ', err);
|
||||
self.backupError = true;
|
||||
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
}, 1);
|
||||
};
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('backupController',
|
||||
angular.module('copayApp.controllers').controller('exportController',
|
||||
function($rootScope, $scope, $timeout, $log, backupService, storageService, profileService, isMobile, notification, go, gettext, gettextCatalog) {
|
||||
var self = this;
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
self.onGoingProcess = {};
|
||||
self.historyShowLimit = 10;
|
||||
self.updatingTxHistory = {};
|
||||
self.prevState = 'walletHome';
|
||||
|
||||
function strip(number) {
|
||||
return (parseFloat(number.toPrecision(12)));
|
||||
|
|
@ -1105,6 +1106,11 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
});
|
||||
};
|
||||
|
||||
$rootScope.$on('$stateChangeSuccess', function(ev, to, toParams, from, fromParams) {
|
||||
self.prevState = from.name || 'walletHome';
|
||||
self.tab = 'walletHome';
|
||||
});
|
||||
|
||||
$rootScope.$on('Local/ClearHistory', function(event) {
|
||||
$log.debug('The wallet transaction history has been deleted');
|
||||
self.txHistory = self.completeHistory = [];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue