-
Notifications
You must be signed in to change notification settings - Fork 13
/
511.3874144deaef524a8a49.js
1 lines (1 loc) · 15.3 KB
/
511.3874144deaef524a8a49.js
1
"use strict";(this.webpackChunkBitShares2_light=this.webpackChunkBitShares2_light||[]).push([[511],{13796:(e,t,a)=>{a.d(t,{A:()=>p});var l=a(96540),n=a(31267),s=a(80849),r=a.n(s),c=a(32795),o=a(46863),i=a(72090),m=a(46128),d=a(10658),u=a.n(d);class p extends l.Component{constructor(){super(),this.state=this._getInitialState()}_getInitialState(){return{password:null,brainkey:null,invalid_password:!1}}render(){var e,t=o.A.getWallet().brainkey_backup_date,a=t?l.createElement("div",null,l.createElement(r(),{content:"wallet.brainkey_backed_up"}),":"," ",l.createElement(n.XU,{value:t})):l.createElement(r(),{className:"facolor-error",component:"p",content:"wallet.brainkey_not_backed_up"});if(this.state.verified){var s=i.hash.sha1(this.state.brainkey).toString("hex").substring(0,4);e=l.createElement("div",null,l.createElement("h3",null,l.createElement(r(),{content:"wallet.brainkey"})),l.createElement(m.Card,null,this.state.brainkey),l.createElement("br",null),l.createElement("pre",{className:"no-overflow"},"sha1 hash of the brainkey: ",s),l.createElement("br",null),a)}return!e&&this.state.brainkey&&(s=i.hash.sha1(this.state.brainkey).toString("hex").substring(0,4),e=l.createElement("span",null,l.createElement("h3",null,l.createElement(r(),{content:"wallet.brainkey"})),l.createElement(m.Card,null,this.state.brainkey),l.createElement("div",{style:{padding:"10px 0"}},l.createElement("pre",{className:"no-overflow"},"sha1 hash of your brainkey: ",s)),l.createElement("hr",null),l.createElement("div",{style:{padding:"10px 0 20px 0"}},l.createElement(r(),{content:"wallet.brainkey_w1"}),l.createElement("br",null),l.createElement(r(),{content:"wallet.brainkey_w2"}),l.createElement("br",null),l.createElement(r(),{content:"wallet.brainkey_w3"})),l.createElement(m.Button,{type:"primary",onClick:this.onComplete.bind(this)},l.createElement(r(),{content:"wallet.verify"})),l.createElement(m.Button,{type:"default",onClick:this.reset.bind(this)},l.createElement(r(),{content:"wallet.cancel"})))),e||(this.state.password&&this.state.password,e=l.createElement("span",null,l.createElement("label",null,l.createElement(r(),{content:"wallet.enter_password"})),l.createElement("form",{onSubmit:this.onSubmit.bind(this),className:"name-form",noValidate:!0},l.createElement(m.Input,{type:"password",id:"password",onChange:this.onPassword.bind(this)}),l.createElement("div",null,a,l.createElement("br",null)),l.createElement(m.Button,{type:"primary",onClick:this.onSubmit.bind(this)},l.createElement(r(),{content:"wallet.show_brainkey"}))))),l.createElement("div",{className:"grid-block vertical"},l.createElement("div",{className:"grid-content no-overflow"},e))}onComplete(e){this.setState({verified:!0}),c.A.setBrainkeyBackupDate()}reset(e){e&&e.preventDefault(),this.setState(this._getInitialState())}onBack(e){e.preventDefault(),window.history.back()}onSubmit(e){e.preventDefault();var t=o.A.isLocked();let{success:a}=o.A.validatePassword(this.state.password,!0);if(a){var l=o.A.getBrainKey();t&&o.A.onLock(),this.setState({brainkey:l})}else m.Notification.error({message:u().translate("notifications.invalid_password")})}onPassword(e){this.setState({password:e.target.value})}}},42578:(e,t,a)=>{a.d(t,{A:()=>v});var l=a(96540),n=a(54625),s=a(80849),r=a.n(s),c=a(46863),o=a(9404),i=a.n(o),m=a(32485),d=a.n(m),u=a(5556),p=a.n(u),h=a(10658),w=a.n(h),E=a(46128);const b=E.Form.Item;class _ extends l.Component{static propTypes={onValid:p().func.isRequired};constructor(){super(),this.state={password:"",confirm:"",errors:i().Map(),valid:!1}}componentDidMount(){this.refs.firstPassword&&this.refs.firstPassword.focus()}formChange(e){let t={};t["current-password"===e.target.id?"password":"confirm"]=e.target.value,this.setState(t,this.validate)}validate(e=this.state){let{password:t,confirm:a}=e;a=a.trim(),t=t.trim();let l=i().Map();0!==t.length&&t.length<8&&(l=l.set("password_length","Password must be 8 characters or more")),""!==t&&""!==a&&t!==a&&(l=l.set("password_match","Passwords do not match"));let n=t.length>=8&&t===a;this.setState({errors:l,valid:n}),this.props.onValid(n?t:null)}render(){const{password:e,confirm:t,errors:a}=this.state;let{newPassword:n}=this.props,s=1;return l.createElement("div",{className:d()({"has-error":a.size})},l.createElement(b,{label:w().translate(n?"wallet.new_password":"wallet.password")},l.createElement("section",null,l.createElement("input",{type:"password",id:"current-password",autoComplete:"current-password",ref:"firstPassword",onChange:this.formChange.bind(this),value:e,tabIndex:s++}))),l.createElement(b,{label:w().translate(n?"wallet.new_confirm":"wallet.confirm")},l.createElement("section",null,l.createElement("input",{type:"password",id:"new-password",autoComplete:"new-password",onChange:this.formChange.bind(this),value:t,tabIndex:s++}))),l.createElement("div",{style:{paddingBottom:10}},a.get("password_match")||a.get("password_length")),this.props.children,l.createElement("br",null))}}const g=E.Form.Item;class v extends l.Component{constructor(){super(),this.state={success:!1}}onAccept(e){e.preventDefault();var{old_password:t,new_password:a}=this.state;c.A.changePassword(t,a,!0).then((()=>{E.Notification.success({message:w().translate("notifications.password_change_success")}),this.setState({success:!0})})).catch((e=>{console.error(e),E.Notification.error({message:w().translate("notifications.password_change_failure",{error_msg:e})})}))}onOldPassword(e){this.setState({old_password:e})}onNewPassword(e){this.setState({new_password:e})}_onCancel(){this.setState({old_password:""}),this.refs.pwd.cancel()}render(){var e=!!this.state.new_password;let{success:t}=this.state;return t?l.createElement("div",null,l.createElement(r(),{component:"p",content:"wallet.change_success"}),l.createElement(r(),{component:"p",content:"wallet.change_backup"}),l.createElement(n.N_,{to:"/wallet/backup/create"},l.createElement(E.Button,null,l.createElement(r(),{content:"wallet.create_backup"})))):l.createElement("span",null,l.createElement(k,{ref:"pwd",onValid:this.onOldPassword.bind(this)},l.createElement(_,{onSubmit:this.onAccept.bind(this),newPassword:!0,onValid:this.onNewPassword.bind(this)},l.createElement(E.Button,{type:"primary",disabled:!e,htmlType:"submit",style:{marginRight:"16px"},onClick:this.onAccept.bind(this)},l.createElement(r(),{content:"wallet.accept"})),l.createElement(E.Button,{onClick:this._onCancel.bind(this)},l.createElement(r(),{content:"wallet.cancel"})))))}}class k extends l.Component{static propTypes={onValid:p().func.isRequired};constructor(){super(),this.state={password:"",verified:!1}}cancel(){this.setState({verified:!1,password:""})}onPassword(e){e.preventDefault();let{success:t}=c.A.validatePassword(this.state.password,!0);t?(this.setState({verified:!0}),this.props.onValid(this.state.password)):E.Notification.error({message:w().translate("notifications.invalid_password")})}formChange(e){var t={};t[e.target.id]=e.target.value,this.setState(t)}render(){return this.state.verified?l.createElement("div",{className:"grid-content"},this.props.children):l.createElement(E.Form,{onSubmit:this.onPassword.bind(this)},l.createElement(g,{label:w().translate("wallet.existing_password")},l.createElement("section",null,l.createElement(E.Input,{placeholder:w().translate("wallet.current_pass"),type:"password",id:"password",autoComplete:"current-password",onChange:this.formChange.bind(this),value:this.state.password})),l.createElement(E.Button,{type:"primary",onClick:this.onPassword.bind(this),style:{marginTop:10}},l.createElement(r(),{content:"wallet.submit"}))))}}},92511:(e,t,a)=>{a.r(t),a.d(t,{ChangeActiveWallet:()=>x,WalletDelete:()=>A,WalletOptions:()=>S,default:()=>B});var l=a(96540),n=a(54625),s=a(9476),r=a(32795),c=a(66518),o=a(98933),i=a(80849),m=a.n(i),d=(a(32485),a(10658)),u=a.n(d),p=a(24180),h=a(25322),w=a(87133),E=a(62390),b=a(42578),_=a(11186),g=a(99425),v=a(13796),k=a(46128);const f=k.Form.Item,y=k.Select.Option,C={listenTo:()=>[o.A],getProps:()=>o.A.getState()};class N extends l.Component{getTitle(){switch(this.props.location.pathname){case"/wallet/create":return"wallet.create_wallet";case"/wallet/backup/create":return"wallet.create_backup";case"/wallet/backup/restore":return"wallet.restore_backup";case"/wallet/backup/brainkey":return"wallet.backup_brainkey";case"/wallet/delete":return"wallet.delete_wallet";case"/wallet/change-password":return"wallet.change_password";case"/wallet/import-keys":return"wallet.import_keys";default:return"wallet.console"}}render(){return l.createElement("div",{className:"grid-block vertical"},l.createElement("div",{className:"grid-container",style:{maxWidth:"40rem"}},l.createElement("div",{className:"content-block"},l.createElement("div",{className:"page-header"},l.createElement(m(),{component:"h3",content:this.getTitle()})),l.createElement("div",{className:"content-block"},l.createElement(p.dO,null,l.createElement(p.qh,{exact:!0,path:"/wallet",component:S}),l.createElement(p.qh,{exact:!0,path:"/wallet/change",component:x}),l.createElement(p.qh,{exact:!0,path:"/wallet/change-password",component:b.A}),l.createElement(p.qh,{exact:!0,path:"/wallet/import-keys",component:w.A}),l.createElement(p.qh,{exact:!0,path:"/wallet/brainkey",component:h.ExistingAccountOptions}),l.createElement(p.qh,{exact:!0,path:"/wallet/create",component:_.G}),l.createElement(p.qh,{exact:!0,path:"/wallet/delete",component:A}),l.createElement(p.qh,{exact:!0,path:"/wallet/backup/restore",component:g.jY}),l.createElement(p.qh,{exact:!0,path:"/wallet/backup/create",component:g.J7}),l.createElement(p.qh,{exact:!0,path:"/wallet/backup/brainkey",component:v.A}),l.createElement(p.qh,{exact:!0,path:"/wallet/balance-claims",component:E.A}))))))}}N=(0,s.N)(N,C);class S extends l.Component{render(){let e=!!this.props.current_wallet,t=this.props.wallet_names.size>1,a=this.props.current_wallet?this.props.current_wallet.toUpperCase():"";return l.createElement("span",null,l.createElement("div",{className:"grid-block"},l.createElement("div",{className:"grid-content"},l.createElement(k.Card,null,l.createElement("label",null,l.createElement(m(),{content:"wallet.active_wallet"}),":"),l.createElement("div",null,a),l.createElement("br",null),t?l.createElement(n.N_,{to:"/wallet/change"},l.createElement("div",{className:"button outline success"},l.createElement(m(),{content:"wallet.change_wallet"}))):null)),l.createElement("div",{className:"grid-content"},l.createElement(k.Card,null,l.createElement("label",null,l.createElement(m(),{content:"wallet.import_keys_tool"})),l.createElement("div",{style:{visibility:"hidden"}},"Dummy"),l.createElement("br",null),e?l.createElement(n.N_,{to:"/wallet/import-keys"},l.createElement("div",{className:"button outline success"},l.createElement(m(),{content:"wallet.import_keys"}))):null)),e?l.createElement("div",{className:"grid-content"},l.createElement(k.Card,null,l.createElement("label",null,l.createElement(m(),{content:"wallet.balance_claims"})),l.createElement("div",{style:{visibility:"hidden"}},"Dummy"),l.createElement("br",null),l.createElement(n.N_,{to:"/wallet/balance-claims"},l.createElement("div",{className:"button outline success"},l.createElement(m(),{content:"wallet.balance_claim_lookup"}))))):null),e?l.createElement(n.N_,{to:"/wallet/backup/create"},l.createElement("div",{className:"button outline success"},l.createElement(m(),{content:"wallet.create_backup"}))):null,e?l.createElement(n.N_,{to:"/wallet/backup/brainkey"},l.createElement("div",{className:"button outline success"},l.createElement(m(),{content:"wallet.backup_brainkey"}))):null,l.createElement(n.N_,{to:"/wallet/backup/restore"},l.createElement("div",{className:"button outline success"},l.createElement(m(),{content:"wallet.restore_backup"}))),l.createElement("br",null),e?l.createElement("br",null):null,l.createElement(n.N_,{to:"/wallet/create"},l.createElement("div",{className:"button outline success"},l.createElement(m(),{content:"wallet.new_wallet"}))),e?l.createElement(n.N_,{to:"/wallet/delete"},l.createElement("div",{className:"button outline success"},l.createElement(m(),{content:"wallet.delete_wallet"}))):null,e?l.createElement(n.N_,{to:"/wallet/change-password"},l.createElement("div",{className:"button outline success"},l.createElement(m(),{content:"wallet.change_password"}))):null)}}S=(0,s.N)(S,C);class x extends l.Component{constructor(){super(),this.state={}}UNSAFE_componentWillMount(){let e=this.props.current_wallet;this.setState({current_wallet:e})}UNSAFE_componentWillReceiveProps(e){e.current_wallet!==this.state.current_wallet&&this.setState({current_wallet:e.current_wallet})}render(){let e=o.A.getState(),t=[];e.wallet_names.forEach((e=>{t.push(l.createElement(y,{key:e,value:e},e.toLowerCase()))}));let a=this.state.current_wallet!==this.props.current_wallet;return l.createElement("div",null,l.createElement("section",null,l.createElement(f,{label:u().translate("wallet.active_wallet"),className:"no-offset"},l.createElement("ul",{className:"unstyled-list"},l.createElement("li",{className:"with-dropdown",style:{borderBottom:0}},e.wallet_names.count()<=1?l.createElement(k.Input,{className:"settings--input",defaultValue:this.state.current_wallet,disabled:!0}):l.createElement(k.Select,{className:"settings--select",value:this.state.current_wallet,onChange:this.onChange.bind(this)},t))))),l.createElement(n.N_,{to:"/wallet/create"},l.createElement(k.Button,{style:{marginRight:"16px"}},l.createElement(m(),{content:"wallet.new_wallet"}))),a?l.createElement(k.Button,{onClick:this.onConfirm.bind(this)},l.createElement(m(),{content:"wallet.change",name:this.state.current_wallet})):null)}onConfirm(){r.A.setWallet(this.state.current_wallet),c.Ay.reset()}onChange(e){let t=e;this.setState({current_wallet:t})}}x=(0,s.N)(x,C);class A extends l.Component{constructor(){super(),this.state={selected_wallet:null,confirm:0}}_onCancel(){this.setState({confirm:0,selected_wallet:null})}render(){if(1===this.state.confirm)return l.createElement("div",{style:{paddingTop:20}},l.createElement("h4",null,l.createElement(m(),{content:"wallet.delete_confirm_line1"})),l.createElement(m(),{component:"p",content:"wallet.delete_confirm_line3"}),l.createElement("br",null),l.createElement(k.Button,{onClick:this.onConfirm2.bind(this),style:{marginRight:"16px"}},l.createElement(m(),{content:"wallet.delete_confirm_line4",name:this.state.selected_wallet})),l.createElement(k.Button,{onClick:this._onCancel.bind(this)},l.createElement(m(),{content:"wallet.cancel"})));let e=[l.createElement(y,{key:"placeholder",value:" ",disabled:this.props.wallet_names.size>1}," ")];e.push(l.createElement(y,{key:"select_option",value:""},u().translate("settings.delete_select"),"…")),this.props.wallet_names.forEach((t=>{e.push(l.createElement(y,{key:t,value:t},t.toLowerCase()))}));let t=!!this.state.selected_wallet;return l.createElement("div",{style:{paddingTop:20}},l.createElement("section",null,l.createElement(f,{label:u().translate("wallet.delete_wallet"),className:"no-offset"},l.createElement("ul",{className:"unstyled-list"},l.createElement("li",{className:"with-dropdown",style:{borderBottom:0}},l.createElement(k.Select,{className:"settings--select",value:this.state.selected_wallet||"",style:{margin:"0 auto"},onChange:this.onChange.bind(this)},e))))),l.createElement(k.Button,{disabled:!t,onClick:this.onConfirm.bind(this)},l.createElement(m(),{content:this.state.selected_wallet?"wallet.delete_wallet_name":"wallet.delete_wallet",name:this.state.selected_wallet})))}onConfirm(){this.setState({confirm:1})}onConfirm2(){r.A.deleteWallet(this.state.selected_wallet),this._onCancel()}onChange(e){this.setState({selected_wallet:e})}}A=(0,s.N)(A,C);const B=N}}]);