Skip to content

Commit e616ab7

Browse files
authored
Merge pull request #7283 from umbraco/2fa-code-update
Updated 2FA code as per feedback
2 parents 914b542 + 723397e commit e616ab7

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

16/umbraco-cms/reference/security/two-factor-authentication.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ A setup for members needs to be implemented on your website in order for you to
3232

3333
As an example, the guide will use the [GoogleAuthenticator NuGet Package](https://www.nuget.org/packages/GoogleAuthenticator/). This package works for both Google and Microsoft authenticator apps. It can be used to generate the QR code needed to activate the app for the website.
3434

35-
1. Install the GoogleAuthenticator Nuget Package on your project.
35+
1. Install the `GoogleAuthenticator` Nuget Package on your project.
3636
2. Create a new file in your project: `UmbracoAppAuthenticator.cs`.
3737
3. Update the file with the following code snippet.
3838

@@ -254,7 +254,7 @@ This guide will not cover setting up the UI for user login and edits as this is
254254

255255
As an example, the guide will use the [GoogleAuthenticator NuGet Package](https://www.nuget.org/packages/GoogleAuthenticator/). This package works for both Google and Microsoft authenticator apps. It can be used to generate the QR code needed to activate the app for the website.
256256

257-
1. Install the GoogleAuthenticator Nuget Package on your project.
257+
1. Install the `GoogleAuthenticator` Nuget Package on your project.
258258
2. Create a new file in your project: `UmbracoUserAppAuthenticator.cs`.
259259
3. Update the file with the following code snippet.
260260

@@ -313,20 +313,20 @@ public class UmbracoUserAppAuthenticator : ITwoFactorProvider
313313
/// <param name="userOrMemberKey">The key of the user or member</param>
314314
/// <param name="secret">The secret that ensures only this user can connect to the authenticator app</param>
315315
/// <returns>The required data to setup the authenticator app</returns>
316-
public Task<ISetupTwoFactorModel> GetSetupDataAsync(Guid userOrMemberKey, string secret)
316+
public async Task<ISetupTwoFactorModel> GetSetupDataAsync(Guid userOrMemberKey, string secret)
317317
{
318-
IUser? user = _userService.GetByKey(userOrMemberKey);
318+
IUser? user = await _userService.GetAsync(userOrMemberKey);
319319

320320
ArgumentNullException.ThrowIfNull(user);
321321

322322
var applicationName = "My application name";
323323
var twoFactorAuthenticator = new TwoFactorAuthenticator();
324324
SetupCode setupInfo = twoFactorAuthenticator.GenerateSetupCode(applicationName, user.Username, secret, false);
325-
return Task.FromResult<ISetupTwoFactorModel>(new TwoFactorAuthInfo()
325+
return new TwoFactorAuthInfo()
326326
{
327327
QrCodeSetupImageUrl = setupInfo.QrCodeSetupImageUrl,
328328
Secret = secret
329-
});
329+
};
330330
}
331331

332332
/// <summary>

0 commit comments

Comments
 (0)