From e9476d270692fc2108a69d236504efb22a1ce511 Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Fri, 21 Apr 2023 18:10:37 -0500 Subject: [PATCH] Tweak copy and layout of app passwords --- src/view/com/modals/AddAppPasswords.tsx | 41 ++++++++++++++++++------- src/view/screens/AppPasswords.tsx | 4 +-- 2 files changed, 31 insertions(+), 14 deletions(-) diff --git a/src/view/com/modals/AddAppPasswords.tsx b/src/view/com/modals/AddAppPasswords.tsx index 6e604dff12..1d2f80ff0e 100644 --- a/src/view/com/modals/AddAppPasswords.tsx +++ b/src/view/com/modals/AddAppPasswords.tsx @@ -2,6 +2,7 @@ import React, {useState} from 'react' import {StyleSheet, TextInput, View, TouchableOpacity} from 'react-native' import {Text} from '../util/text/Text' import {Button} from '../util/forms/Button' +import {s} from 'lib/styles' import {useStores} from 'state/index' import {usePalette} from 'lib/hooks/usePalette' import {isDesktopWeb} from 'platform/detection' @@ -71,23 +72,34 @@ export function Component({}: {}) { }, [store]) const createAppPassword = async () => { - const newPassword = await store.me.createAppPassword(name) - if (newPassword) { - setAppPassword(newPassword.password) - } else { + try { + const newPassword = await store.me.createAppPassword(name) + if (newPassword) { + setAppPassword(newPassword.password) + } else { + Toast.show('Failed to create app password.') + // TODO: better error handling (?) + } + } catch (e) { Toast.show('Failed to create app password.') - // TODO: better error handling (?) + store.log.error('Failed to create app password', {e}) } } return ( - - {!appPassword - ? 'Please enter a unique name for this App Password. We have generated a random name for you.' - : "Please save this secret key somewhere safe and accessible. For security reasons, you won't be able to view it again. If you lose this secret key, you'll need to generate a new one."} - + {!appPassword ? ( + + Please enter a unique name for this App Password. We have generated + a random name for you. + + ) : ( + + Here is your app password. Use this to + sign into the other app along with your handle. + + )} {!appPassword ? ( )} + {appPassword ? ( + + For security reasons, you won't be able to view this again. If you + lose this password, you'll need to generate a new one. + + ) : null}