This repository has been archived by the owner on Nov 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3694 from ethcore/jr-print-recovery-phrase
button to print recovery phrase
- v3.0.1
- v3.0.0
- v3.0.0-alpha.1
- v2.7.2
- v2.7.1
- v2.7.0
- v2.6.8
- v2.6.7
- v2.6.6
- v2.6.5
- v2.6.4
- v2.6.3
- v2.6.2
- v2.6.1
- v2.6.0
- v2.5.14
- v2.5.13
- v2.5.12
- v2.5.11
- v2.5.10
- v2.5.9
- v2.5.8
- v2.5.7
- v2.5.6
- v2.5.5
- v2.5.4
- v2.5.3
- v2.5.2
- v2.5.1
- v2.5.0
- v2.4.9
- v2.4.8
- v2.4.7
- v2.4.6
- v2.4.5
- v2.4.4
- v2.4.3
- v2.4.2
- v2.4.1
- v2.4.0
- v2.4.0-rc0
- v2.3.9
- v2.3.8
- v2.3.7
- v2.3.6
- v2.3.5
- v2.3.5-rc0
- v2.3.4
- v2.3.3
- v2.3.2
- v2.3.1
- v2.3.0
- v2.2.11
- v2.2.10
- v2.2.9
- v2.2.8
- v2.2.7
- v2.2.6
- v2.2.5
- v2.2.4
- v2.2.3
- v2.2.2
- v2.2.1
- v2.2.0
- v2.2.0-rc8
- v2.2.0-rc7
- v2.2.0-rc6
- v2.2.0-rc5
- v2.2.0-rc4
- v2.2.0-rc3
- v2.2.0-rc2
- v2.2.0-rc1
- v2.2.0-rc0
- v2.1.11
- v2.1.10
- v2.1.9
- v2.1.8
- v2.1.7
- v2.1.6
- v2.1.5
- v2.1.4
- v2.1.3
- v2.1.2
- v2.1.1
- v2.1.0
- v2.1.0-rc4
- v2.1.0-rc3
- v2.1.0-rc2
- v2.1.0-rc1
- v2.1.0-rc0
- v2.0.9
- v2.0.8
- v2.0.7
- v2.0.6
- v2.0.5
- v2.0.5-rc0
- v2.0.4
- v2.0.3
- v2.0.3-rc0
- v2.0.1
- v2.0.0
- v2.0.0-rc3
- v2.0.0-rc2
- v2.0.0-rc1
- v2.0.0-rc0
- v1.12.0-ci5
- v1.12.0-ci4
- v1.12.0-ci3
- v1.12.0-ci2
- v1.12.0-ci1
- v1.12.0-ci0
- v1.11.11
- v1.11.10
- v1.11.8
- v1.11.7
- v1.11.7-rc2
- v1.11.7-rc1
- v1.11.7-rc0
- v1.11.6
- v1.11.6-rc2
- v1.11.6-rc1
- v1.11.6-rc0
- v1.11.5
- v1.11.5-ci1
- v1.11.5-ci0
- v1.11.4
- v1.11.4-ci0
- v1.11.3
- v1.11.2-ci0
- v1.11.1
- v1.11.0
- v1.11.0-ci0
- v1.10.9
- v1.10.9-rc0
- v1.10.8
- v1.10.8-ci1
- v1.10.8-ci0
- v1.10.7
- v1.10.7-ci0
- v1.10.6
- v1.10.5
- v1.10.5-rc0
- v1.10.5-ci1
- v1.10.5-ci0
- v1.10.4
- v1.10.3
- v1.10.3-ci1
- v1.10.3-ci0
- v1.10.2
- v1.10.2-ci1
- v1.10.2-ci0
- v1.10.1
- v1.10.1-ci0
- v1.10.0
- v1.10.0-ci7
- v1.10.0-ci6
- v1.10.0-ci5
- v1.10.0-ci4
- v1.10.0-ci3
- v1.10.0-ci2
- v1.10.0-ci1
- v1.10.0-ci0
- v1.9.7
- v1.9.7-ci1
- v1.9.7-ci0
- v1.9.6
- v1.9.6-ci2
- v1.9.6-ci1
- v1.9.6-ci0
- v1.9.5
- v1.9.5-ci6
- v1.9.5-ci5
- v1.9.5-ci4
- v1.9.5-ci3
- v1.9.5-ci2
- v1.9.5-ci1
- v1.9.5-ci0
- v1.9.4
- v1.9.4-ci0
- v1.9.3
- v1.9.3-ci5
- v1.9.3-ci4
- v1.9.3-ci3
- v1.9.3-ci2
- v1.9.3-ci1
- v1.9.3-ci0
- v1.9.2
- v1.9.2-ci0
- v1.9.1
- v1.9.1-ci3
- v1.9.1-ci2
- v1.9.1-ci1
- v1.9.1-ci0
- v1.9.0
- v1.8.11
- v1.8.11-ci0
- v1.8.10
- v1.8.10-ci5
- v1.8.10-ci4
- v1.8.10-ci3
- v1.8.10-ci2
- v1.8.10-ci1
- v1.8.10-ci0
- v1.8.9
- v1.8.9-ci0
- v1.8.8
- v1.8.8-ci4
- v1.8.8-ci3
- v1.8.8-ci2
- v1.8.8-ci1
- v1.8.8-ci0
- v1.8.7
- v1.8.6
- v1.8.5
- v1.8.4
- v1.8.3
- v1.8.2
- v1.8.1
- v1.8.0
- v1.7.13
- v1.7.12
- v1.7.11
- v1.7.10
- v1.7.9
- v1.7.8
- v1.7.7
- v1.7.6
- v1.7.5
- v1.7.4
- v1.7.3
- v1.7.2
- v1.7.1
- v1.7.0
- v1.6.10
- v1.6.9
- v1.6.8
- v1.6.7
- v1.6.6
- v1.6.5
- v1.6.4
- v1.6.3
- v1.6.2
- v1.6.1
- v1.6.0
- v1.5.13
- v1.5.12
- v1.5.11
- v1.5.10
- v1.5.9
- v1.5.8
- v1.5.7
- v1.5.6
- v1.5.4
- v1.5.3
- v1.5.2
- v1.5.0
Showing
5 changed files
with
147 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// Copyright 2015, 2016 Ethcore (UK) Ltd. | ||
// This file is part of Parity. | ||
|
||
// Parity is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
|
||
// Parity is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
// You should have received a copy of the GNU General Public License | ||
// along with Parity. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
export const onPrint = (window, cb) => { | ||
let called = false; let query, queryFn; | ||
|
||
const onPrint = () => { | ||
if (queryFn) { | ||
query.removeListener(queryFn); | ||
} | ||
window.removeEventListener('afterprint', onPrint, false); | ||
if (!called) { | ||
called = true; | ||
cb(); | ||
} | ||
}; | ||
|
||
if (window.matchMedia) { | ||
queryFn = (query) => { | ||
if (!query.matches) { | ||
onPrint(); | ||
} | ||
}; | ||
query = window.matchMedia('print'); | ||
query.addListener(queryFn); | ||
} | ||
window.addEventListener('afterprint', onPrint, false); | ||
}; | ||
|
||
export default (html) => { | ||
const iframe = document.createElement('iframe'); | ||
iframe.setAttribute('sandbox', 'allow-modals allow-same-origin allow-scripts'); | ||
iframe.setAttribute('src', '/'); | ||
iframe.setAttribute('style', 'display: none'); | ||
document.body.appendChild(iframe); | ||
const teardown = () => { | ||
// Safari crashes without a timeout. | ||
setTimeout(() => document.body.removeChild(iframe), 0); | ||
}; | ||
|
||
setTimeout(() => { | ||
iframe.contentDocument.write(html); | ||
|
||
setTimeout(() => { | ||
onPrint(iframe.contentWindow, teardown); | ||
iframe.contentWindow.focus(); | ||
iframe.contentWindow.print(); | ||
}, 20); | ||
}, 0); | ||
}; |
49 changes: 49 additions & 0 deletions
49
js/src/modals/CreateAccount/AccountDetails/recovery-page.ejs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<!DOCTYPE html> | ||
|
||
<html lang="en"> | ||
<head> | ||
<title>Recovery phrase for <%= name %></title> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width"> | ||
<style> | ||
body { | ||
margin: 2em auto; | ||
max-width: 30em; | ||
padding: 1em; | ||
text-align: center; | ||
font-size: 110%; | ||
font-family: sans-serif; | ||
font-weight: 300; | ||
} | ||
#logo { | ||
max-width: 4rem; | ||
margin-bottom: 3rem; | ||
} | ||
p { | ||
margin-bottom: 1rem; | ||
} | ||
figure { | ||
margin-bottom: 1rem; | ||
} | ||
figure.address img { | ||
border-radius: 100%; | ||
} | ||
pre code { | ||
display: inline-block; | ||
text-align: center; | ||
white-space: normal; | ||
line-height: 1.3; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<img id="logo" src="<%= logo %>" alt="Parity Logo" /> | ||
<p>This is your account <em><%= name %></em>:</p> | ||
<figure class="address"> | ||
<img src="<%= identity %>" alt="symbol for the address of the account" /> | ||
<figcaption><code><%= address %></code></figcaption> | ||
</figure> | ||
<p>This is the recovery phrase:</p> | ||
<pre><code><%= phrase %></code></pre> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters