changed name to email

This commit is contained in:
Kim 2023-07-06 11:09:16 +02:00
parent c738804b1c
commit fc3ad1806c
3 changed files with 4 additions and 4 deletions

View File

@ -16,7 +16,7 @@ public class Controller : ControllerBase
[HttpPost(nameof(Login))]
public ActionResult<Session> Login(String username, String? password)
{
var user = Db.GetUserByName(username);
var user = Db.GetUserByEmail(username);
if (user is null)
{

View File

@ -93,7 +93,7 @@ public static class UserMethods
public static Boolean VerifyPassword(this User user, String password)
{
return Db.GetUserByName(user.Name)?.Password == user.SaltAndHashPassword(password);
return Db.GetUserByEmail(user.Name)?.Password == user.SaltAndHashPassword(password);
}

View File

@ -26,10 +26,10 @@ public static partial class Db
.FirstOrDefault(u => u.Id == id);
}
public static User? GetUserByName(String userName)
public static User? GetUserByEmail(String userName)
{
return Users
.FirstOrDefault(u => u.Name == userName);
.FirstOrDefault(u => u.Email == userName);
}
public static Session? GetSession(String token)