diff --git a/ProjectLighthouse.Localization/Register.resx b/ProjectLighthouse.Localization/Register.resx index e6eb08fc..1e530f21 100644 --- a/ProjectLighthouse.Localization/Register.resx +++ b/ProjectLighthouse.Localization/Register.resx @@ -22,6 +22,6 @@ Caution: Your username MUST match your PSN/RPCN username in order to be able to sign in from in-game. - The game will be read-only until you verify your email + You do not have an email set on your account or you have not verified it. You can set an email by opening the text chat and typing "/setemail [youremail@example.com]" (do not include the brackets), then check your inbox for a verification email. \ No newline at end of file diff --git a/ProjectLighthouse.Localization/StringLists/RegisterStrings.cs b/ProjectLighthouse.Localization/StringLists/RegisterStrings.cs index c9acf363..85f6f29a 100644 --- a/ProjectLighthouse.Localization/StringLists/RegisterStrings.cs +++ b/ProjectLighthouse.Localization/StringLists/RegisterStrings.cs @@ -3,6 +3,7 @@ namespace LBPUnion.ProjectLighthouse.Localization.StringLists; public static class RegisterStrings { public static readonly TranslatableString UsernameNotice = create("username_notice"); + public static readonly TranslatableString EmailVerificationNotice = create("email_verify_notice"); private static TranslatableString create(string key) => new(TranslationAreas.Register, key); } \ No newline at end of file diff --git a/ProjectLighthouse.Servers.GameServer/Controllers/MessageController.cs b/ProjectLighthouse.Servers.GameServer/Controllers/MessageController.cs index 7093aa03..488c3591 100644 --- a/ProjectLighthouse.Servers.GameServer/Controllers/MessageController.cs +++ b/ProjectLighthouse.Servers.GameServer/Controllers/MessageController.cs @@ -3,7 +3,6 @@ using LBPUnion.ProjectLighthouse.Configuration; using LBPUnion.ProjectLighthouse.Database; using LBPUnion.ProjectLighthouse.Extensions; using LBPUnion.ProjectLighthouse.Helpers; -using LBPUnion.ProjectLighthouse.Localization; using LBPUnion.ProjectLighthouse.Localization.StringLists; using LBPUnion.ProjectLighthouse.Logging; using LBPUnion.ProjectLighthouse.Serialization; @@ -56,16 +55,23 @@ along with this program. If not, see ."; { GameTokenEntity token = this.GetToken(); - string username = await this.database.UsernameFromGameToken(token); + UserEntity? user = await this.database.UserFromGameToken(token); + if (user == null) return this.Forbid(); StringBuilder announceText = new(ServerConfiguration.Instance.AnnounceText); - announceText.Replace("%user", username); + announceText.Replace("%user", user.Username); announceText.Replace("%id", token.UserId.ToString()); + if (ServerConfiguration.Instance.Mail.RequireEmailVerification) + { + announceText.Insert(0, + RegisterStrings.EmailVerificationNotice.Translate(user.Language) + "\n\n"); + } + if (ServerConfiguration.Instance.UserGeneratedContentLimits.ReadOnlyMode) { - announceText.Insert(0, BaseLayoutStrings.ReadOnlyWarn.Translate(LocalizationManager.DefaultLang) + "\n\n"); + announceText.Insert(0, BaseLayoutStrings.ReadOnlyWarn.Translate(user.Language) + "\n\n"); } #if DEBUG @@ -102,7 +108,7 @@ along with this program. If not, see ."; { GameNotification verifyEmailNotification = new(); verifyEmailNotification.Type = NotificationType.ModerationNotification; - verifyEmailNotification.Text = LocalizationManager.GetLocalizedString(TranslationAreas.Register, user.Language, "email_verify_notice"); + verifyEmailNotification.Text = RegisterStrings.EmailVerificationNotice.Translate(user.Language); builder.AppendLine(LighthouseSerializer.Serialize(this.HttpContext.RequestServices, verifyEmailNotification)); }