mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-19 03:31:29 +00:00
Limit text length and number of level labels
This commit is contained in:
parent
40d7562660
commit
2a44e85a30
3 changed files with 5 additions and 3 deletions
|
@ -29,10 +29,10 @@ public class SlotSettingsPage : BaseLayout
|
|||
if (avatarHash != null) this.Slot.IconHash = avatarHash;
|
||||
|
||||
name = SanitizationHelper.SanitizeString(name);
|
||||
if (this.Slot.Name != name) this.Slot.Name = name;
|
||||
if (this.Slot.Name != name && name.Length <= 64) this.Slot.Name = name;
|
||||
|
||||
description = SanitizationHelper.SanitizeString(description);
|
||||
if (this.Slot.Description != description) this.Slot.Description = description;
|
||||
if (this.Slot.Description != description && description.Length <= 512) this.Slot.Description = description;
|
||||
|
||||
labels = LabelHelper.RemoveInvalidLabels(SanitizationHelper.SanitizeString(labels));
|
||||
if (this.Slot.AuthorLabels != labels) this.Slot.AuthorLabels = labels;
|
||||
|
|
|
@ -37,7 +37,7 @@ public class UserSettingsPage : BaseLayout
|
|||
|
||||
biography = SanitizationHelper.SanitizeString(biography);
|
||||
|
||||
if (this.ProfileUser.Biography != biography) this.ProfileUser.Biography = biography;
|
||||
if (this.ProfileUser.Biography != biography && biography.Length <= 512) this.ProfileUser.Biography = biography;
|
||||
|
||||
if (ServerConfiguration.Instance.Mail.MailEnabled && IsValidEmail(email) && (this.User == this.ProfileUser || this.User.IsAdmin))
|
||||
{
|
||||
|
|
|
@ -110,6 +110,8 @@ public static class LabelHelper
|
|||
public static string RemoveInvalidLabels(string authorLabels)
|
||||
{
|
||||
List<string> labels = new(authorLabels.Split(","));
|
||||
if (labels.Count > 5) labels = labels.GetRange(0, 5);
|
||||
|
||||
for (int i = labels.Count - 1; i >= 0; i--)
|
||||
{
|
||||
if (!IsValidLabel(labels[i])) labels.Remove(labels[i]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue