rebase and comment out keytar

This commit is contained in:
Sean Yesmunt 2019-08-27 15:11:56 -04:00
parent 30d396fce9
commit ec1f48484e
7 changed files with 35 additions and 27 deletions

View file

@ -1,7 +1,7 @@
// @flow // @flow
import React from 'react'; import React from 'react';
import { Modal } from 'modal/modal'; import { Modal } from 'modal/modal';
import keytar from 'keytar'; // import keytar from 'keytar';
type Props = { type Props = {
closeModal: () => void, closeModal: () => void,
@ -18,11 +18,12 @@ class ModalPasswordUnsave extends React.PureComponent<Props> {
type="confirm" type="confirm"
confirmButtonLabel={__('Forget')} confirmButtonLabel={__('Forget')}
abortButtonLabel={__('Nevermind')} abortButtonLabel={__('Nevermind')}
onConfirmed={() => onConfirmed={
keytar.deletePassword('LBRY', 'wallet_password').then(() => { () => {}
this.props.setPasswordSaved(false); // keytar.deletePassword('LBRY', 'wallet_password').then(() => {
this.props.closeModal(); // this.props.setPasswordSaved(false);
}) // this.props.closeModal();
// })
} }
onAborted={this.props.closeModal} onAborted={this.props.closeModal}
> >

View file

@ -2,7 +2,7 @@
import React from 'react'; import React from 'react';
import { Modal } from 'modal/modal'; import { Modal } from 'modal/modal';
import Button from 'component/button'; import Button from 'component/button';
import keytar from 'keytar'; // import keytar from 'keytar';
type Props = { type Props = {
closeModal: () => void, closeModal: () => void,
@ -26,7 +26,7 @@ class ModalWalletDecrypt extends React.PureComponent<Props, State> {
const { props, state } = this; const { props, state } = this;
if (state.submitted && props.walletDecryptSucceded === true) { if (state.submitted && props.walletDecryptSucceded === true) {
keytar.deletePassword('LBRY', 'wallet_password'); // keytar.deletePassword('LBRY', 'wallet_password');
props.setPasswordSaved(false); props.setPasswordSaved(false);
props.closeModal(); props.closeModal();
props.updateWalletStatus(); props.updateWalletStatus();

View file

@ -3,7 +3,6 @@ import React from 'react';
import { Form, FormField, Submit } from 'component/common/form'; import { Form, FormField, Submit } from 'component/common/form';
import { Modal } from 'modal/modal'; import { Modal } from 'modal/modal';
import Button from 'component/button'; import Button from 'component/button';
import keytar from 'keytar';
type Props = { type Props = {
closeModal: () => void, closeModal: () => void,
@ -89,7 +88,7 @@ class ModalWalletEncrypt extends React.PureComponent<Props, State> {
} }
if (state.rememberPassword === true) { if (state.rememberPassword === true) {
this.props.setPasswordSaved(true); this.props.setPasswordSaved(true);
keytar.setPassword('LBRY', 'wallet_password', state.newPassword); // keytar.setPassword('LBRY', 'wallet_password', state.newPassword);
} }
this.setState({ submitted: true }); this.setState({ submitted: true });
this.props.encryptWallet(state.newPassword); this.props.encryptWallet(state.newPassword);

View file

@ -3,7 +3,7 @@ import React from 'react';
import { Form, FormField } from 'component/common/form'; import { Form, FormField } from 'component/common/form';
import { Modal } from 'modal/modal'; import { Modal } from 'modal/modal';
import Button from 'component/button'; import Button from 'component/button';
import keytar from 'keytar'; // import keytar from 'keytar';
type Props = { type Props = {
quit: () => void, quit: () => void,
@ -30,7 +30,7 @@ class ModalWalletUnlock extends React.PureComponent<Props, State> {
if (props.walletUnlockSucceded === true) { if (props.walletUnlockSucceded === true) {
if (this.state.rememberPassword) { if (this.state.rememberPassword) {
this.props.setPasswordSaved(true); this.props.setPasswordSaved(true);
keytar.setPassword('LBRY', 'wallet_password', this.state.password); // keytar.setPassword('LBRY', 'wallet_password', this.state.password);
} }
props.closeModal(); props.closeModal();
} }

View file

@ -12,7 +12,7 @@ import Page from 'component/page';
import SettingLanguage from 'component/settingLanguage'; import SettingLanguage from 'component/settingLanguage';
import FileSelector from 'component/common/file-selector'; import FileSelector from 'component/common/file-selector';
import UnsupportedOnWeb from 'component/common/unsupported-on-web'; import UnsupportedOnWeb from 'component/common/unsupported-on-web';
import keytar from 'keytar'; // import keytar from 'keytar';
import WalletSecurityAndSync from '../../component/walletSecurityAndSync'; import WalletSecurityAndSync from '../../component/walletSecurityAndSync';
type Price = { type Price = {
@ -99,13 +99,13 @@ class SettingsPage extends React.PureComponent<Props, State> {
componentDidMount() { componentDidMount() {
this.props.getThemes(); this.props.getThemes();
this.props.updateWalletStatus(); this.props.updateWalletStatus();
keytar.getPassword('LBRY', 'wallet_password').then(p => { // keytar.getPassword('LBRY', 'wallet_password').then(p => {
if (p || p === '') { // if (p || p === '') {
this.props.setPasswordSaved(true); // this.props.setPasswordSaved(true);
} else { // } else {
this.props.setPasswordSaved(false); // this.props.setPasswordSaved(false);
} // }
}); // });
} }
onKeyFeeChange(newValue: Price) { onKeyFeeChange(newValue: Price) {

View file

@ -14,8 +14,14 @@ const select = (state, props) => {
const { pathname, hash } = props.location; const { pathname, hash } = props.location;
const urlPath = pathname + hash; const urlPath = pathname + hash;
// Remove the leading "/" added by the browser // Remove the leading "/" added by the browser
<<<<<<< HEAD
const path = urlPath.slice(1).replace(/:/g, '#'); const path = urlPath.slice(1).replace(/:/g, '#');
=======
const path = pathname.slice(1).replace(/:/g, '#');
console.log('path', path);
debugger;
>>>>>>> rebase and comment out keytar
let uri; let uri;
try { try {
uri = normalizeURI(path); uri = normalizeURI(path);

View file

@ -1,15 +1,17 @@
import keytar from 'keytar'; // import keytar from 'keytar';
import { AUTH_ORG } from 'constants/keychain'; import { AUTH_ORG } from 'constants/keychain';
export const setSavedPassword = (key, value) => { export const setSavedPassword = (key, value) => {
keytar.setPassword(AUTH_ORG, key, value); // keytar.setPassword(AUTH_ORG, key, value);
}; };
export const getSavedPassword = key => { export const getSavedPassword = key => {
return keytar // return keytar
.getPassword(AUTH_ORG, key) // .getPassword(AUTH_ORG, key)
.then(p => p) // .then(p => p)
.catch(e => console.error(e)); // .catch(e => console.error(e));
}; };
export const deleteSavedPassword = key => keytar.deletePassword(AUTH_ORG, key).catch(e => console.error(e)); export const deleteSavedPassword = key => {
// keytar.deletePassword(AUTH_ORG, key).catch(e => console.error(e));
};