mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-26 23:18:39 +00:00
Add announcement text to notify users of email enforcement requirements
This commit is contained in:
parent
9e9c96e1a3
commit
7495c41d44
1 changed files with 25 additions and 3 deletions
|
@ -55,18 +55,40 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.";
|
|||
{
|
||||
GameTokenEntity token = this.GetToken();
|
||||
|
||||
string username = await this.database.UsernameFromGameToken(token);
|
||||
UserEntity? user = await this.database.UserFromGameToken(token);
|
||||
|
||||
StringBuilder announceText = new(ServerConfiguration.Instance.AnnounceText);
|
||||
|
||||
announceText.Replace("%user", username);
|
||||
announceText.Replace("%id", token.UserId.ToString());
|
||||
announceText.Replace("%user", user.Username);
|
||||
announceText.Replace("%id", user.UserId.ToString());
|
||||
|
||||
if (ServerConfiguration.Instance.UserGeneratedContentLimits.ReadOnlyMode)
|
||||
{
|
||||
announceText.Insert(0, BaseLayoutStrings.ReadOnlyWarn.Translate(LocalizationManager.DefaultLang) + "\n\n");
|
||||
}
|
||||
|
||||
if (EnforceEmailConfiguration.Instance.EnableEmailEnforcement && user.EmailAddress == null)
|
||||
{
|
||||
if (user.EmailAddress == null)
|
||||
{
|
||||
// This will probably need translations
|
||||
announceText.Insert(0,
|
||||
"This server instance has email enforcement enabled, " +
|
||||
"you will need to set and verify an email address to use most features.\n" +
|
||||
"You can set an email by opening the text chat and typing " +
|
||||
"\"/setemail [youremail@example.com]\" (do not include the brackets.\n\n");
|
||||
}
|
||||
if (!user.EmailAddressVerified)
|
||||
{
|
||||
// More stuff to translate later
|
||||
announceText.Insert(0,
|
||||
"You have set an email address on your account, but you have not verified " +
|
||||
"it. Make sure to check your inbox for a verification email. " +
|
||||
"If you have not received an email, please contact an instance " +
|
||||
"administrator for further assistance.\n\n");
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
announceText.Append("\n\n---DEBUG INFO---\n" +
|
||||
$"user.UserId: {token.UserId}\n" +
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue