Fix dev environment
This commit is contained in:
parent
58ee088545
commit
24ed3ced20
|
@ -4,14 +4,20 @@ using Microsoft.AspNetCore.Http;
|
|||
using trainav.web.database;
|
||||
using trainav.web.database.Tables;
|
||||
|
||||
namespace trainav.web.Utils;
|
||||
namespace trainav.web.Utils;
|
||||
|
||||
public static class AuthUtil {
|
||||
public static string GetRemoteUser(HttpContext ctx, Database.DbConn db) {
|
||||
#if (DEBUG)
|
||||
const string remoteUser = "zotan";
|
||||
#else
|
||||
var remoteUser = ctx.Request.Headers["Remote-User"];
|
||||
#endif
|
||||
|
||||
if (!db.Users.Any(p => p.Username == remoteUser)) {
|
||||
db.InsertWithInt32Identity(new User {Username = remoteUser});
|
||||
db.InsertWithInt32Identity(new User { Username = remoteUser });
|
||||
}
|
||||
return ctx.Request.Headers["Remote-User"];
|
||||
|
||||
return remoteUser;
|
||||
}
|
||||
}
|
||||
|
|
Reference in New Issue