Skip to content

Commit 691bece

Browse files
authored
fix: fix profile reading (#281)
1 parent ad63b3f commit 691bece

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/Eppie.CLI/Eppie.CLI/Menu/Actions.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ void CancelLogin(object? sender, ConsoleCancelEventArgs e)
405405
Console.WriteLine($"Authorization to {mailServer} service. Press Ctrl+C to cancel the operation.");
406406
AuthCredential authCredential = await authClient.LoginAsync(cancellationLogin.Token).ConfigureAwait(false);
407407

408-
string? email = await ReadEmailAddressAsync(authCredential).ConfigureAwait(false);
408+
string? email = await ReadEmailAddressAsync(authClient, authCredential).ConfigureAwait(false);
409409

410410
if (!string.IsNullOrEmpty(email))
411411
{
@@ -485,17 +485,18 @@ private void OnCoreException(object? sender, ExceptionEventArgs e)
485485
_application.WriteError(e.Exception);
486486
}
487487

488-
private static async Task<string?> ReadEmailAddressAsync(AuthCredential authCredential)
488+
private static async Task<string?> ReadEmailAddressAsync(IAuthorizationClient client, AuthCredential credential)
489489
{
490-
ArgumentNullException.ThrowIfNull(authCredential);
490+
ArgumentNullException.ThrowIfNull(client);
491+
ArgumentNullException.ThrowIfNull(credential);
491492

492-
if (authCredential is IProfileReader profileReader)
493+
if (client is IProfileReader profileReader)
493494
{
494-
IUserProfile profile = await profileReader.ReadProfileAsync(authCredential).ConfigureAwait(false);
495+
IUserProfile profile = await profileReader.ReadProfileAsync(credential).ConfigureAwait(false);
495496
return profile.Email;
496497
}
497498

498-
return authCredential.ReadEmailAddress();
499+
return credential.ReadEmailAddress();
499500
}
500501
}
501502
}

0 commit comments

Comments
 (0)