Merge branch 'main' of https://git.innov.energy/Innovenergy/git_trunk
This commit is contained in:
commit
ba4a47c1aa
|
@ -16,7 +16,7 @@ public class Controller : ControllerBase
|
||||||
[HttpPost(nameof(Login))]
|
[HttpPost(nameof(Login))]
|
||||||
public ActionResult<Session> Login(String username, String? password)
|
public ActionResult<Session> Login(String username, String? password)
|
||||||
{
|
{
|
||||||
var user = Db.GetUserByName(username);
|
var user = Db.GetUserByEmail(username);
|
||||||
|
|
||||||
if (user is null)
|
if (user is null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -93,7 +93,7 @@ public static class UserMethods
|
||||||
|
|
||||||
public static Boolean VerifyPassword(this User user, String password)
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -26,10 +26,10 @@ public static partial class Db
|
||||||
.FirstOrDefault(u => u.Id == id);
|
.FirstOrDefault(u => u.Id == id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static User? GetUserByName(String userName)
|
public static User? GetUserByEmail(String userName)
|
||||||
{
|
{
|
||||||
return Users
|
return Users
|
||||||
.FirstOrDefault(u => u.Name == userName);
|
.FirstOrDefault(u => u.Email == userName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Session? GetSession(String token)
|
public static Session? GetSession(String token)
|
||||||
|
|
Loading…
Reference in New Issue