Update regex
This commit is contained in:
@@ -168,13 +168,13 @@ public class UserService : IUserService
|
||||
|
||||
public async Task<User> UpdateTelegramChannel(User user, string telegramChannel)
|
||||
{
|
||||
// Validate Telegram channel format (must start with @ and contain only allowed characters)
|
||||
// Validate Telegram channel format (numeric channel ID only)
|
||||
if (!string.IsNullOrEmpty(telegramChannel))
|
||||
{
|
||||
string pattern = @"^@[a-zA-Z0-9_]{5,32}$";
|
||||
string pattern = @"^[0-9]{5,15}$";
|
||||
if (!Regex.IsMatch(telegramChannel, pattern))
|
||||
{
|
||||
throw new Exception("Invalid Telegram channel format. Must start with @ and be 5-32 characters long, containing only letters, numbers, and underscores.");
|
||||
throw new Exception("Invalid Telegram channel format. Must be numeric channel ID (5-15 digits).");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user