Skip to content
This repository has been archived by the owner on Sep 11, 2023. It is now read-only.

Commit

Permalink
Update password correct checker
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrydnl committed Oct 24, 2019
1 parent 34a7632 commit 5c88b11
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Text.RegularExpressions;
using StashBot.Module.User;

namespace StashBot.Module.Message.Handler.ChatStateHandler
Expand Down Expand Up @@ -62,14 +63,21 @@ private bool CheckPassword(long chatId, string password)

if (password.Length < 12)
{
const string warningMessage = "Min length 12";
const string warningMessage = "Password min length 12!";
messageManager.SendMessage(chatId, warningMessage);
return false;
}

if (password.Length > 25)
{
const string warningMessage = "Max length 25";
const string warningMessage = "Password max length 25!";
messageManager.SendMessage(chatId, warningMessage);
return false;
}

if (!Regex.IsMatch(password, @"^[a-zA-Z0-9!""#$%&'()*+,-./:;<=>?@[\]^_`{|}~]+$"))
{
const string warningMessage = "Password can contain only letters, numbers and special characters!";
messageManager.SendMessage(chatId, warningMessage);
return false;
}
Expand Down

0 comments on commit 5c88b11

Please sign in to comment.