fix(auth): every call with a code after the password takes the address
Whoever guessed codes decided whether the owner was mailed (the re-review's fourth finding): the address a sign-in sent was optional, so a guesser left it out and no mail went, and a wait begun without a mail used up the one mail there was. Every call carrying a code after the password or the phrase proved (signing in, the phrase's reset, a change of password, a new phrase, deletion) now takes the account's address and the language of its mails, and is refused (wrongCredentials, as anything wrong after the password) before any code is checked when the address isn't the account's; every wait mails the owner, not only the first. The app sends the address the person typed, or for changes while signed in the one this device signed in with, and says so where it doesn't know it (addressUnknown). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
e8c4a3d472
commit
2a21672b43
1 changed files with 795 additions and 347 deletions
|
|
@ -31,6 +31,7 @@ void main() {
|
|||
await passwords.signIn(
|
||||
await passwords.unlock('anna@example.org', 'correct horse'),
|
||||
totpCode: fakeTotpCode,
|
||||
language: 'en',
|
||||
),
|
||||
);
|
||||
gateway.calls.clear();
|
||||
|
|
@ -263,6 +264,7 @@ void main() {
|
|||
['wrong', 'wrong', 'wrong'],
|
||||
password: 'correct horse',
|
||||
code: fakeTotpCode,
|
||||
language: 'en',
|
||||
);
|
||||
expect(cubit.state, at(NewPhraseStep.check, phraseWrong: true));
|
||||
// Nothing reached the instance before the words were right.
|
||||
|
|
@ -275,6 +277,7 @@ void main() {
|
|||
wordsAsked(cubit.state),
|
||||
password: 'wrong',
|
||||
code: fakeTotpCode,
|
||||
language: 'en',
|
||||
),
|
||||
),
|
||||
[
|
||||
|
|
@ -286,6 +289,7 @@ void main() {
|
|||
wordsAsked(cubit.state),
|
||||
password: 'correct horse',
|
||||
code: '000000',
|
||||
language: 'en',
|
||||
);
|
||||
expect(
|
||||
cubit.state,
|
||||
|
|
@ -300,6 +304,7 @@ void main() {
|
|||
wordsAsked(cubit.state),
|
||||
password: 'correct horse',
|
||||
code: fakeTotpCode,
|
||||
language: 'en',
|
||||
),
|
||||
),
|
||||
[
|
||||
|
|
|
|||
Loading…
Reference in a new issue