Update user profile url pattern
parent
1dcbf254b0
commit
ba569ac388
|
@ -51,7 +51,7 @@ else {
|
|||
<div class="input-group-prepend">
|
||||
<span class="input-group-text" style="width:23ch">Profile URL</span>
|
||||
</div>
|
||||
<input type="text" class="form-control" id="input-profileurl" value="@Program.RootDomain/profile/@user.Username" disabled>
|
||||
<input type="text" class="form-control" id="input-profileurl" value="@Program.RootDomain/@user.Username" disabled>
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-outline-secondary" role="button" id="button-copy-profileurl" onclick="copyToClipboard(document.getElementById('input-profileurl').value);">Copy</button>
|
||||
</div>
|
||||
|
|
|
@ -15,11 +15,11 @@
|
|||
<p>The following users are currently live:</p>
|
||||
<div class="btn-group btn-group" role="group">
|
||||
@foreach (var user in liveUsers) {
|
||||
<a href="/profile/@user" class="btn btn-primary" role="button">@user</a>
|
||||
<a href="/@user" class="btn btn-primary" role="button">@user</a>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
else {
|
||||
<p>At the moment, no users are live. Please check back later!</p>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@page "{user}"
|
||||
@page "/{user}"
|
||||
@using RTMPDash.DataModels
|
||||
@model ProfileModel
|
||||
@{
|
||||
|
@ -54,4 +54,4 @@
|
|||
<p>@user.PronounSubject.FirstCharToUpper() @pronounAdditional not currently live. @user.PronounSubject.FirstCharToUpper() have not specified an announcement URL, so check back later!</p>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
|
@ -11,28 +11,35 @@ namespace RTMPDash.Pages;
|
|||
public class RegisterModel : PageModel {
|
||||
public void OnPost() {
|
||||
if (!Request.HasFormContentType
|
||||
|| string.IsNullOrWhiteSpace(Request.Form["user"])
|
||||
|| string.IsNullOrWhiteSpace(Request.Form["pass"])
|
||||
|| string.IsNullOrWhiteSpace(Request.Form["code"]))
|
||||
|| string.IsNullOrWhiteSpace(Request.Form["user"])
|
||||
|| string.IsNullOrWhiteSpace(Request.Form["pass"])
|
||||
|| string.IsNullOrWhiteSpace(Request.Form["code"]))
|
||||
return;
|
||||
|
||||
using var db = new AppDb.DbConn();
|
||||
if (!db.Invites.Any(p => p.Code == Request.Form["code"]))
|
||||
return;
|
||||
|
||||
var user = db.Users.FirstOrDefault(p => p.Username == Request.Form["user"].ToString());
|
||||
var newUser = Request.Form["user"].ToString().ToLowerInvariant();
|
||||
var user = db.Users.FirstOrDefault(p => p.Username == newUser);
|
||||
if (user != null) {
|
||||
//user already exists
|
||||
Response.Redirect("/Register?e=user_exists");
|
||||
return;
|
||||
}
|
||||
|
||||
if (db.Users.Any(p => p.StreamKey == Request.Form["user"] || p.PrivateAccessKey == Request.Form["user"])) {
|
||||
if (db.Users.Any(p => p.StreamKey == newUser || p.PrivateAccessKey == newUser)) {
|
||||
//user invalid
|
||||
Response.Redirect("/Register?e=user_invalid");
|
||||
return;
|
||||
}
|
||||
|
||||
if (newUser is "register" or "login" or "logout" or "privacy" or "stats" or "index" or "error" or "dashboard" or "credits" or "admin" or "content") {
|
||||
// user invalid
|
||||
Response.Redirect("/Register?e=user_invalid");
|
||||
return;
|
||||
}
|
||||
|
||||
user = new User {
|
||||
Username = Request.Form["user"].ToString(),
|
||||
Password = Request.Form["pass"].ToString().Sha256(),
|
||||
|
@ -49,4 +56,4 @@ public class RegisterModel : PageModel {
|
|||
|
||||
HttpContext.Session.SetString("authenticatedUser", user.Username);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -166,7 +166,7 @@ WantedBy=multi-user.target
|
|||
|
||||
player.on("ended", function(){
|
||||
console.log('Stream ended. Redirecting to profile.');
|
||||
document.location = 'https://chaos.stream/profile/' + window.location.pathname.substring(1);
|
||||
document.location = 'https://chaos.stream/' + window.location.pathname.substring(1);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue