mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-29 08:28:39 +00:00
User settings, level settings, language and timezone selection and more. (#471)
* Initial work for user settings page * Finish user setting and slot setting pages * Don't show slot upload date on home page and fix team pick redirection * Fix upload image button alignment on mobile * Fix image upload on iPhone * Remove unused css and add selected button color * Fix login email check and bump ChromeDriver to 105 * Remove duplicated code and allow users to leave fields empty * Add unpublish button on level settings and move settings button position * Don't show edit button on mini card * Self review bug fixes and users can no longer use an in-use email
This commit is contained in:
parent
9073a8266f
commit
f6a7fe6283
53 changed files with 973 additions and 118 deletions
|
@ -1,12 +1,13 @@
|
|||
#nullable enable
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using LBPUnion.ProjectLighthouse.Configuration;
|
||||
using LBPUnion.ProjectLighthouse.Helpers;
|
||||
using LBPUnion.ProjectLighthouse.Localization.StringLists;
|
||||
using LBPUnion.ProjectLighthouse.Logging;
|
||||
using LBPUnion.ProjectLighthouse.PlayerData;
|
||||
using LBPUnion.ProjectLighthouse.PlayerData.Profiles;
|
||||
using LBPUnion.ProjectLighthouse.PlayerData.Profiles.Email;
|
||||
using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts;
|
||||
using LBPUnion.ProjectLighthouse.Types;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
|
@ -19,6 +20,8 @@ public class SetEmailForm : BaseLayout
|
|||
|
||||
public EmailSetToken? EmailToken;
|
||||
|
||||
public string? Error { get; private set; }
|
||||
|
||||
public async Task<IActionResult> OnGet(string? token = null)
|
||||
{
|
||||
if (!ServerConfiguration.Instance.Mail.MailEnabled) return this.NotFound();
|
||||
|
@ -32,6 +35,7 @@ public class SetEmailForm : BaseLayout
|
|||
return this.Page();
|
||||
}
|
||||
|
||||
[SuppressMessage("ReSharper", "SpecifyStringComparison")]
|
||||
public async Task<IActionResult> OnPost(string emailAddress, string token)
|
||||
{
|
||||
if (!ServerConfiguration.Instance.Mail.MailEnabled) return this.NotFound();
|
||||
|
@ -39,6 +43,13 @@ public class SetEmailForm : BaseLayout
|
|||
EmailSetToken? emailToken = await this.Database.EmailSetTokens.Include(t => t.User).FirstOrDefaultAsync(t => t.EmailToken == token);
|
||||
if (emailToken == null) return this.Redirect("/login");
|
||||
|
||||
if (await this.Database.Users.AnyAsync(u => u.EmailAddress != null && u.EmailAddress.ToLower() == emailAddress.ToLower()))
|
||||
{
|
||||
this.Error = this.Translate(ErrorStrings.EmailTaken);
|
||||
this.EmailToken = emailToken;
|
||||
return this.Page();
|
||||
}
|
||||
|
||||
emailToken.User.EmailAddress = emailAddress;
|
||||
this.Database.EmailSetTokens.Remove(emailToken);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue