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,24 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using StudentHouseDashboard.Managers;
using StudentHouseDashboard.Models;
namespace WebApp.Pages
{
public class RegisterModel : PageModel
{
[BindProperty]
public User MyUser { get; set; }
public void OnGet()
{
}
public void OnPost()
{
var userManager = new UserManager();
if (userManager.CreateUser(MyUser.Name, BCrypt.Net.BCrypt.HashPassword(MyUser.Password), MyUser.Role))
{
ViewData["confirm"] = $"Successfully registered {MyUser.Name}!";
}
}
}
}