[fix](client): sign in with the email the hub identifies, not a username
Sign-in labels the single identity field 'Username', but `login()` sends it as
`email` and dcntrlized-auth resolves accounts by the email column. Typing the
username of a seeded account ('admin') therefore fails with 'invalid
credentials' while the password is correct. The field is now labelled Email,
with an email keyboard and a matching placeholder, in sign-in mode only —
registration still has a separate username and email.
This commit is contained in:
@@ -72,14 +72,24 @@ export default function LoginScreen() {
|
|||||||
</AppText>
|
</AppText>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<Field label="Username" accessibilityLabel="Username">
|
{/* Sign-in identifies the account by EMAIL: the auth hub's identity
|
||||||
|
is the email column, and `login()` sends this value as `email`.
|
||||||
|
Labelling it "Username" made the seeded accounts unusable —
|
||||||
|
typing the username from the seed file fails with "invalid
|
||||||
|
credentials" even though the password is right. Registration is
|
||||||
|
the only flow that has both a username and an email. */}
|
||||||
|
<Field
|
||||||
|
label={isRegister ? 'Username' : 'Email'}
|
||||||
|
accessibilityLabel={isRegister ? 'Username' : 'Email'}
|
||||||
|
>
|
||||||
<TextInputBox
|
<TextInputBox
|
||||||
value={username}
|
value={username}
|
||||||
onChangeText={setUsername}
|
onChangeText={setUsername}
|
||||||
autoCapitalize="none"
|
autoCapitalize="none"
|
||||||
autoCorrect={false}
|
autoCorrect={false}
|
||||||
accessibilityLabel="Username"
|
keyboardType={isRegister ? 'default' : 'email-address'}
|
||||||
placeholder="your username"
|
accessibilityLabel={isRegister ? 'Username' : 'Email'}
|
||||||
|
placeholder={isRegister ? 'your username' : '[email protected]'}
|
||||||
/>
|
/>
|
||||||
</Field>
|
</Field>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user