mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-09-28 04:09:05 +00:00
Friendlier messages
This commit is contained in:
parent
1d16b3cc42
commit
96d92c911c
3 changed files with 13 additions and 6 deletions
|
@ -22,6 +22,6 @@
|
||||||
<value>Caution: Your username MUST match your PSN/RPCN username in order to be able to sign in from in-game.</value>
|
<value>Caution: Your username MUST match your PSN/RPCN username in order to be able to sign in from in-game.</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="email_verify_notice" xml:space="preserve">
|
<data name="email_verify_notice" xml:space="preserve">
|
||||||
<value>The game will be read-only until you verify your email</value>
|
<value>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.</value>
|
||||||
</data>
|
</data>
|
||||||
</root>
|
</root>
|
|
@ -3,6 +3,7 @@ namespace LBPUnion.ProjectLighthouse.Localization.StringLists;
|
||||||
public static class RegisterStrings
|
public static class RegisterStrings
|
||||||
{
|
{
|
||||||
public static readonly TranslatableString UsernameNotice = create("username_notice");
|
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);
|
private static TranslatableString create(string key) => new(TranslationAreas.Register, key);
|
||||||
}
|
}
|
|
@ -3,7 +3,6 @@ using LBPUnion.ProjectLighthouse.Configuration;
|
||||||
using LBPUnion.ProjectLighthouse.Database;
|
using LBPUnion.ProjectLighthouse.Database;
|
||||||
using LBPUnion.ProjectLighthouse.Extensions;
|
using LBPUnion.ProjectLighthouse.Extensions;
|
||||||
using LBPUnion.ProjectLighthouse.Helpers;
|
using LBPUnion.ProjectLighthouse.Helpers;
|
||||||
using LBPUnion.ProjectLighthouse.Localization;
|
|
||||||
using LBPUnion.ProjectLighthouse.Localization.StringLists;
|
using LBPUnion.ProjectLighthouse.Localization.StringLists;
|
||||||
using LBPUnion.ProjectLighthouse.Logging;
|
using LBPUnion.ProjectLighthouse.Logging;
|
||||||
using LBPUnion.ProjectLighthouse.Serialization;
|
using LBPUnion.ProjectLighthouse.Serialization;
|
||||||
|
@ -56,16 +55,23 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.";
|
||||||
{
|
{
|
||||||
GameTokenEntity token = this.GetToken();
|
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);
|
StringBuilder announceText = new(ServerConfiguration.Instance.AnnounceText);
|
||||||
|
|
||||||
announceText.Replace("%user", username);
|
announceText.Replace("%user", user.Username);
|
||||||
announceText.Replace("%id", token.UserId.ToString());
|
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)
|
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
|
#if DEBUG
|
||||||
|
@ -102,7 +108,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.";
|
||||||
{
|
{
|
||||||
GameNotification verifyEmailNotification = new();
|
GameNotification verifyEmailNotification = new();
|
||||||
verifyEmailNotification.Type = NotificationType.ModerationNotification;
|
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));
|
builder.AppendLine(LighthouseSerializer.Serialize(this.HttpContext.RequestServices, verifyEmailNotification));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue