mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-08-10 22:08:39 +00:00
Dont hardcode user as "jvyden"
This commit is contained in:
parent
b287e34425
commit
59ba45036d
7 changed files with 37 additions and 14 deletions
|
@ -1,6 +1,7 @@
|
|||
#nullable enable
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using ProjectLighthouse.Helpers;
|
||||
using ProjectLighthouse.Types;
|
||||
|
@ -60,5 +61,13 @@ namespace ProjectLighthouse {
|
|||
if(token == null) return null;
|
||||
return await Users.FirstOrDefaultAsync(u => u.UserId == token.UserId);
|
||||
}
|
||||
|
||||
public async Task<User?> UserFromRequest(HttpRequest request) {
|
||||
if(!request.Cookies.TryGetValue("MM_AUTH", out string? mmAuth) || mmAuth == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return await UserFromAuthToken(mmAuth);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue