feat: finished email confirmation, finished Password Reset

!fix: The user auth system now uses the id, not the email

Signed-off-by: limited_dev <loginakkisativ@gmail.com>
This commit is contained in:
limited_dev 2023-06-09 09:45:14 +02:00
parent 828f784fc8
commit e8e97b2cd9
11 changed files with 89 additions and 20 deletions

View file

@ -124,7 +124,7 @@
var cauthStateProvder = (CustomAuthenticationStateProvider)authStateProvider;
var user = await cauthStateProvder.GetAuthenticationStateAsync();
var usr = user.User;
UserData foundusr = await UsersRepository.getUserByEmailAsync(usr.Identity.Name);
UserData foundusr = await UsersRepository.getUserByIdAsync(int.Parse(usr.Identity.Name));
if (foundusr.Role != "User" || comment.UserID == foundusr.UserID)
{
await TheManager.deleteComment(comment);
@ -148,7 +148,7 @@
var cauthStateProvder = (CustomAuthenticationStateProvider)authStateProvider;
var user = await cauthStateProvder.GetAuthenticationStateAsync();
var usr = user.User;
UserData foundusr = await UsersRepository.getUserByEmailAsync(usr.Identity.Name);
UserData foundusr = await UsersRepository.getUserByIdAsync(int.Parse(usr.Identity.Name));
if (foundusr != null && (foundusr.Role != "User" || comment.UserID == foundusr.UserID))
{
canDel = true;

View file

@ -63,7 +63,7 @@
var cauthStateProvder = (CustomAuthenticationStateProvider)authStateProvider;
var user = await cauthStateProvder.GetAuthenticationStateAsync();
var usr = user.User;
UserData foundusr = await UsersRepository.getUserByEmailAsync(usr.Identity.Name);
UserData foundusr = await UsersRepository.getUserByIdAsync(int.Parse(usr.Identity.Name));
if (foundusr == null)
{
hasErr = true;
@ -90,7 +90,7 @@
var cauthStateProvder = (CustomAuthenticationStateProvider)authStateProvider;
var user = await cauthStateProvder.GetAuthenticationStateAsync();
var usr = user.User;
UserData foundusr = await UsersRepository.getUserByEmailAsync(usr.Identity.Name);
UserData foundusr = await UsersRepository.getUserByIdAsync(int.Parse(usr.Identity.Name));
if (foundusr == null)
{
hasErr = true;

View file

@ -69,7 +69,7 @@
var cauthStateProvder = (CustomAuthenticationStateProvider)authStateProvider;
var user = await cauthStateProvder.GetAuthenticationStateAsync();
var usr = user.User;
UserData foundusr = await UsersRepository.getUserByEmailAsync(usr.Identity.Name);
UserData foundusr = await UsersRepository.getUserByIdAsync(int.Parse(usr.Identity.Name));
if (foundusr == null)
{
hasErr = true;
@ -98,7 +98,7 @@
var cauthStateProvder = (CustomAuthenticationStateProvider)authStateProvider;
var user = await cauthStateProvder.GetAuthenticationStateAsync();
var usr = user.User;
UserData foundusr = await UsersRepository.getUserByEmailAsync(usr.Identity.Name);
UserData foundusr = await UsersRepository.getUserByIdAsync(int.Parse(usr.Identity.Name));
if (foundusr == null)
{
hasErr = true;

View file

@ -157,7 +157,7 @@
var cauthStateProvder = (CustomAuthenticationStateProvider)authStateProvider;
var user = await cauthStateProvder.GetAuthenticationStateAsync();
var usr = user.User;
UserData foundusr = await UsersRepository.getUserByEmailAsync(usr.Identity.Name);
UserData foundusr = await UsersRepository.getUserByIdAsync(int.Parse(usr.Identity.Name));
if (foundusr.Role != "User" || post.UserID == foundusr.UserID)
{
await TheManager.deleteThread(post);
@ -183,11 +183,10 @@
{
await base.OnParametersSetAsync();
value = TheManager.getBumpValue(post) + "v";
string boardTag = post.Board;
var cauthStateProvder = (CustomAuthenticationStateProvider)authStateProvider;
var user = await cauthStateProvder.GetAuthenticationStateAsync();
var usr = user.User;
UserData foundusr = await UsersRepository.getUserByEmailAsync(usr.Identity.Name);
UserData foundusr = await UsersRepository.getUserByIdAsync(int.Parse(usr.Identity.Name));
reportURL = $"/sys/report/op/{post.Board}/{post.PostID}";
threadURL = $"/{post.Board}/thread/{post.PostID}";

View file

@ -28,7 +28,7 @@
var user = await cauthStateProvder.GetAuthenticationStateAsync();
if (user.User.Identity.IsAuthenticated)
{
mail = user.User.Identity.Name;
mail = $"Welcome User # {user.User.Identity.Name}";
}
}
}