From 3876e0537ef25cc04a30e47656c59eb2fc604c4b Mon Sep 17 00:00:00 2001 From: SengokuNadeko <70702835+SengokuNadeko@users.noreply.github.com> Date: Sat, 5 Sep 2020 14:34:46 -0400 Subject: [PATCH] Small regex fix Old regex had some problems (a bit too restrictive). If you want, you can push this to loosen up the restrictions a little. --- src/CNLoginServer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CNLoginServer.cpp b/src/CNLoginServer.cpp index da3233a..469beee 100644 --- a/src/CNLoginServer.cpp +++ b/src/CNLoginServer.cpp @@ -398,8 +398,8 @@ bool CNLoginServer::exitDuplicate(int accountId) } bool CNLoginServer::isLoginDataGood(std::string login, std::string password) { - std::regex loginRegex("^([A-Za-z\\d_\\-]){5,20}$"); - std::regex passwordRegex("^([A-Za-z\\d_\\-@$!%*#?&,.+:;<=>]){8,20}$"); + std::regex loginRegex("^(?=.*[A-Za-z0-9]$)[A-Za-z][A-Za-z\d.-]{3,20}$"); + std::regex passwordRegex("^(?=.*[A-Za-z0-9]$)[A-Za-z][A-Za-z\d.-]{3,20}$"); return (std::regex_match(login, loginRegex) && std::regex_match(password, passwordRegex)); } bool CNLoginServer::isPasswordCorrect(std::string actualPassword, std::string tryPassword)