forked from raquelsa/AspNet.Identity.MySQL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
UserStore.TwoFactorStore.cs
36 lines (33 loc) · 1.04 KB
/
UserStore.TwoFactorStore.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using Microsoft.AspNet.Identity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
namespace AspNet.Identity.MySQL
{
public partial class UserStore<TUser, TRole> : IUserTwoFactorStore<TUser, string>
{
/// <summary>
/// Set two factor authentication is enabled on the user
/// </summary>
/// <param name="user"></param>
/// <param name="enabled"></param>
/// <returns></returns>
public Task SetTwoFactorEnabledAsync(TUser user, bool enabled)
{
user.TwoFactorEnabled = enabled;
userTable.Update(user);
return Task.FromResult(0);
}
/// <summary>
/// Get if two factor authentication is enabled on the user
/// </summary>
/// <param name="user"></param>
/// <returns></returns>
public Task<bool> GetTwoFactorEnabledAsync(TUser user)
{
return Task.FromResult(user.TwoFactorEnabled);
}
}
}