user login, register, hashed passwords, announcements start

This commit is contained in:
Dimitar Byalkov
2023-03-29 11:29:25 +02:00
parent e296205466
commit f858c47ff7
27 changed files with 623 additions and 125 deletions

View File

@@ -0,0 +1,32 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using StudentHouseDashboard.Models;
using StudentHouseDashboard.Managers;
namespace WebApp.Pages
{
public class LoginModel : PageModel
{
[BindProperty]
public User MyUser { get; set; }
public void OnGet()
{
}
public void OnPost()
{
var userManager = new UserManager();
foreach (var item in userManager.GetAllUsers())
{
if (item.Name == MyUser.Name && BCrypt.Net.BCrypt.Verify(MyUser.Password, item.Password))
{
MyUser = item;
ViewData["confirm"] = $"Welcome, {MyUser.Name}! {MyUser.Id}, {MyUser.Password}, {MyUser.Role}";
}
}
}
}
}