Skip to content

Commit

Permalink
Merge pull request #5915 from keybase/cjb/DESKTOP-2875-gpg-suggest-cm…
Browse files Browse the repository at this point in the history
…dline

Refactor rendering, and suggest `keybase login` for gpg problems
  • Loading branch information
cjb committed Feb 20, 2017
2 parents 4bec288 + a69bdcc commit 19c204b
Showing 1 changed file with 35 additions and 39 deletions.
74 changes: 35 additions & 39 deletions shared/login/register/error/index.render.desktop.js
Expand Up @@ -17,41 +17,39 @@ const renderError = (error: RPCError) => {
case ConstantsStatusCode.scdevicenoprovision:
return (
<div>
<p style={{marginBottom: 10}}><Text type='Body'>Sorry!</Text></p>
<p style={{marginBottom: 10}}><Text type='Body'>You can't authorize by passphrase, since you have established device or paper keys.</Text></p>
<p>
<Text type='Body'>What you can do:</Text>
<Text type='Body'> - Go back and pick a device or paper key</Text>
<Text type='Body'> - Reset your account entirely: </Text><Text type='BodyPrimaryLink' onClick={() => openURL('https://keybase.io/#account-reset')}>https://keybase.io/#account-reset</Text>
</p>
<p style={styleText}><Text type='Body'>Sorry!</Text></p>
<p style={styleText}><Text type='Body'>You can't authorize by passphrase, since you have established device or paper keys.</Text></p>
<p style={styleText}><Text type='Body'>What you can do:</Text></p>
<p style={styleText}><Text type='Body'> - Go back and pick a device or paper key</Text></p>
<p style={styleText}><Text type='Body'> - Reset your account entirely: </Text><Text type='BodyPrimaryLink' onClick={() => openURL('https://keybase.io/#account-reset')}>https://keybase.io/#account-reset</Text></p>
</div>)
case ConstantsStatusCode.scdeviceprevprovisioned:
return <Text type='Body'>You have already provisioned this device. Please use 'keybase login [username]' to log in.</Text>
case ConstantsStatusCode.sckeynomatchinggpg:
if (fields.has_active_device) {
return (
<div>
<p style={{marginBottom: 10}}><Text type='Body'>Sorry!</Text></p>
<p style={{marginBottom: 10}}><Text type='Body'>You can't provision using solely a passphrase, since you have active device keys.</Text></p>
<p style={styleText}><Text type='Body'>Sorry!</Text></p>
<p style={styleText}><Text type='Body'>You can't provision using solely a passphrase, since you have active device keys.</Text></p>
<p>
<Text type='Body'>You have options:</Text>
<Text type='Body'> - Go back and select a device or paper key</Text>
<Text type='Body'> - Install Keybase on a machine that has your PGP private key in it</Text>
<Text type='Body'> - Login to the website and host an encrypted copy of your PGP private key</Text>
<Text type='Body'> - or, reset your account entirely: </Text><Text type='BodyPrimaryLink' onClick={() => openURL('https://keybase.io/#account-reset')}>https://keybase.io/#account-reset</Text>
<p style={styleText}><Text type='Body'>You have options:</Text></p>
<p style={styleText}><Text type='Body'> - Go back and select a device or paper key</Text></p>
<p style={styleText}><Text type='Body'> - Install Keybase on a machine that has your PGP private key in it</Text></p>
<p style={styleText}><Text type='Body'> - Login to the website and host an encrypted copy of your PGP private key</Text></p>
<p style={styleText}><Text type='Body'> - or, reset your account entirely: </Text><Text type='BodyPrimaryLink' onClick={() => openURL('https://keybase.io/#account-reset')}>https://keybase.io/#account-reset</Text></p>
</p>
</div>)
} else {
return (
<div>
<p style={{marginBottom: 10}}><Text type='Body'>Sorry!</Text></p>
<p style={{marginBottom: 10}}><Text type='Body'>You can't provision using a passphrase, since you've established a PGP key.</Text></p>
<p>
<Text type='Body'>You have options:</Text>
<Text type='Body'> - Install GPG on this machine and import your PGP private key into it</Text>
<Text type='Body'> - Install Keybase on a different machine that has your PGP key</Text>
<Text type='Body'> - Login to the website and host an encrypted copy of your PGP private key</Text>
<Text type='Body'> - Or, reset your account entirely: </Text><Text type='BodyPrimaryLink' onClick={() => openURL('https://keybase.io/#account-reset')}>https://keybase.io/#account-reset</Text>
<p style={styleText}><Text type='Body'>Sorry!</Text></p>
<p style={styleText}><Text type='Body'>You can't provision using a passphrase, since you've established a PGP key.</Text></p>
<p style={styleText}><Text type='Body'>You have options:</Text></p>
<p style={styleText}><Text type='Body'> - Use <Text type='Terminal'>keybase login</Text> on the command line to log in</Text></p>
<p style={styleText}><Text type='Body'> - Install GPG on this machine and import your PGP private key into it</Text></p>
<p style={styleText}><Text type='Body'> - Install Keybase on a different machine that has your PGP key</Text></p>
<p style={styleText}><Text type='Body'> - Login to the website and host an encrypted copy of your PGP private key</Text></p>
<p style={styleText}><Text type='Body'> - Or, reset your account entirely: </Text><Text type='BodyPrimaryLink' onClick={() => openURL('https://keybase.io/#account-reset')}>https://keybase.io/#account-reset</Text>
</p>
</div>)
}
Expand Down Expand Up @@ -80,34 +78,32 @@ const renderError = (error: RPCError) => {
case ConstantsStatusCode.sckeynosecret:
return (
<p>
<Text type='Body'>Sorry, your account is already established with a PGP public key, but we can't access the corresponding private key.</Text>
<Text type='Body' style={{display: 'inline-block', marginTop: 10, marginBottom: 10}}>You need to prove you're you. We suggest one of the following:</Text>
<Text type='BodySmall' style={{display: 'inline-block'}}> - Install GPG and put your PGP private key on this machine and try again</Text>
<Text type='BodySmall' style={{display: 'inline-block'}}> - Reset your account and start fresh: </Text>
<Text type='BodyPrimaryLink' onClick={() => openURL('https://keybase.io/#account-reset')}>https://keybase.io/#account-reset</Text>
<Text type='BodySmall' style={{display: 'inline-block'}}> - Go back and provision with another device or paper key</Text>
<p style={styleText}><Text type='Body'>Sorry, your account is already established with a PGP public key, but we can't access the corresponding private key.</Text></p>
<p style={styleText}><Text type='Body' style={{marginTop: 10, marginBottom: 10}}>You need to prove you're you. We suggest one of the following:</Text></p>
<p style={styleText}><Text type='Body'> - Use <Text type='Terminal'>keybase login</Text> on the command line to log in</Text></p>
<p style={styleText}><Text type='Body'> - Install GPG and put your PGP private key on this machine and try again</Text></p>
<p style={styleText}><Text type='Body'> - Reset your account and start fresh: </Text> <Text type='BodyPrimaryLink' onClick={() => openURL('https://keybase.io/#account-reset')}>https://keybase.io/#account-reset</Text></p>
<p style={styleText}><Text type='Body'> - Go back and provision with another device or paper key</Text></p>
</p>)
default:
return <Text type='Body'>Unknown error: {error.message}</Text>
}
}

const Render = ({onBack, error}: Props) => (
<Container
style={styles.container}
onBack={onBack}>
<Text type='Header' style={styles.header}>There was an error provisioning</Text>
<Container onBack={onBack}>
<Text type='Header' style={styleHeader}>There was an error provisioning</Text>
{renderError(error)}
</Container>
)

const styles = {
container: {},
header: {
alignSelf: 'center',
marginTop: 46,
marginBottom: 20,
},
const styleHeader = {
alignSelf: 'center',
marginTop: 46,
marginBottom: 20,
}

const styleText = {
marginBottom: 10,
}
export default Render

0 comments on commit 19c204b

Please sign in to comment.