diff --git a/app/assets/locales/locale-cn.json b/app/assets/locales/locale-cn.json
index eb900fba8b..778b0f679e 100644
--- a/app/assets/locales/locale-cn.json
+++ b/app/assets/locales/locale-cn.json
@@ -1155,6 +1155,11 @@
"approval_remove": "同意移除",
"key_approval_add": "同意添加密钥",
"key_approval_remove": "同意移除密钥"
+ },
+ "qrcode":{
+ "label":"二维码",
+ "title":"私钥二维码",
+ "input_messate":"请输入用于加密二维码的密码,密码为空表示不加密"
}
},
"init_error": {
diff --git a/app/assets/locales/locale-en.json b/app/assets/locales/locale-en.json
index d0f389ba64..20a3e5631c 100644
--- a/app/assets/locales/locale-en.json
+++ b/app/assets/locales/locale-en.json
@@ -1187,7 +1187,12 @@
"key_approval_add": "Key approval to add",
"key_approval_remove": "Key approval to remove"
},
- "ok": "OK"
+ "ok": "OK",
+ "qrcode":{
+ "label":"qrcode",
+ "title":"Private key QR code",
+ "input_messate":"Please enter the password used to encrypt the QR code, the password is empty that does not encrypt."
+ }
},
"init_error": {
"title": "Application initialization issues",
diff --git a/app/components/Modal/QrcodeModal.jsx b/app/components/Modal/QrcodeModal.jsx
new file mode 100644
index 0000000000..e028347e43
--- /dev/null
+++ b/app/components/Modal/QrcodeModal.jsx
@@ -0,0 +1,119 @@
+import React, {PropTypes} from "react";
+import ZfApi from "react-foundation-apps/src/utils/foundation-api";
+import BaseModal from "./BaseModal";
+import Translate from "react-translate-component";
+import QRCode from "qrcode.react";
+import {Aes} from "bitsharesjs/es";
+
+
+class QrcodeModal extends React.Component {
+ constructor(props) {
+ super(props);
+ this.state = this._getInitialState();
+ this.onPasswordEnter = this.onPasswordEnter.bind(this);
+ this.onKeyDown = this.onKeyDown.bind(this);
+ this.onCancel = this.onCancel.bind(this);
+ this.onClose = this.onClose.bind(this);
+ }
+
+ _getInitialState() {
+ return {
+ isShowQrcode: false,
+ keyString: null
+ };
+ }
+
+ show() {
+ ZfApi.publish(this.props.modalId, "open");
+ }
+
+ onCancel() {
+ ZfApi.publish(this.props.modalId, "close");
+ this.onClose();
+ }
+
+ onClose() {
+ if (this.refs.password_input) this.refs.password_input.value = "";
+ this.setState(this._getInitialState());
+ }
+
+ onPasswordEnter(e) {
+ e.preventDefault();
+ let pwd = this.refs.password_input.value;
+ let key = this.props.keyValue;
+ if (pwd != null && pwd != "") {
+ if (key !== undefined && key != null && key != "") {
+ let pwd_aes = Aes.fromSeed(pwd);
+ let qrkey = pwd_aes.encryptToHex(key);
+ this.setState({isShowQrcode: true, keyString: qrkey});
+ }
+ } else {
+ //notify.error("You'd better enter a password to encrypt the qr code");
+ this.setState({isShowQrcode: true, keyString: key});
+ }
+ }
+
+ onKeyDown(e) {
+ if (e.keyCode === 13) this.onPasswordEnter(e);
+ }
+
+
+ render() {
+ let pos = null;
+ if(this.state.isShowQrcode)pos = {textAlign: "center"};
+ return (
+
+
+
+