blob: 7d8bf1c15c49b3976f9c4613ed43db4ef035e1be (
plain) (
blame)
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
|
using System;
using Microsoft.AspNetCore.Identity;
namespace Dough.Models.Database
{
public class User : BaseModel
{
public User(string username = default)
{
Username = username;
}
public string Password { get; set; }
public string Username { get; set; }
public void Update(User data)
{
Username = data.Username;
base.Update(data);
}
public void HashAndSetPassword(string password)
{
Password = BCrypt.Net.BCrypt.HashPassword(password);
}
public bool VerifyPassword(string password)
{
return BCrypt.Net.BCrypt.Verify(password, Password);
}
}
}
|