Skip to content

Commit 1047184

Browse files
committed
github: fix bug in 2FA UI helper invocation
Pass the `--sms` option to the UI helper when prompting for a 2FA code sent via SMS for GitHub.
1 parent 72ae203 commit 1047184

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/shared/GitHub.UI/Program.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Threading;
33
using Avalonia;
44
using GitHub.UI.Controls;
5+
using GitHub.UI.Commands;
56
using Microsoft.Git.CredentialManager;
67
using Microsoft.Git.CredentialManager.UI;
78

src/shared/GitHub/GitHubAuthentication.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,10 @@ public async Task<string> GetTwoFactorCodeAsync(Uri targetUri, bool isSms)
189189

190190
if (TryFindHelperExecutablePath(out string helperPath))
191191
{
192-
IDictionary<string, string> resultDict = await InvokeHelperAsync(helperPath, "2fa", null);
192+
var args = new StringBuilder("2fa");
193+
if (isSms) args.Append(" --sms");
194+
195+
IDictionary<string, string> resultDict = await InvokeHelperAsync(helperPath, args.ToString(), null);
193196

194197
if (!resultDict.TryGetValue("code", out string authCode))
195198
{

0 commit comments

Comments
 (0)