aboutsummaryrefslogtreecommitdiffstats
path: root/src/server/Models/Database/User.cs
blob: 479c15c43939fd9b93ecfb40d6962176858f57b2 (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
using System;

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);
        }
    }
}