From 86380d912d5479212d73f430b61f65775aae38f8 Mon Sep 17 00:00:00 2001 From: link Date: Mon, 16 Jan 2023 14:10:39 +0800 Subject: [PATCH] Allow specific special characters (#823) --- route/v1/samba.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/route/v1/samba.go b/route/v1/samba.go index bf3cdac8a..6c080eb48 100644 --- a/route/v1/samba.go +++ b/route/v1/samba.go @@ -131,11 +131,11 @@ func PostSambaConnectionsCreate(c *gin.Context) { return } - if ok, _ := regexp.MatchString("^[a-zA-Z0-9]{4,30}$", connection.Password); !ok { + if ok, _ := regexp.MatchString(`^[\w@#*.]{4,30}$`, connection.Password); !ok { c.JSON(common_err.CLIENT_ERROR, model.Result{Success: common_err.CHARACTER_LIMIT, Message: common_err.GetMsg(common_err.CHARACTER_LIMIT)}) return } - if ok, _ := regexp.MatchString("^[a-zA-Z0-9]{4,30}$", connection.Username); !ok { + if ok, _ := regexp.MatchString(`^[\w@#*.]{4,30}$`, connection.Username); !ok { c.JSON(common_err.CLIENT_ERROR, model.Result{Success: common_err.INVALID_PARAMS, Message: common_err.GetMsg(common_err.INVALID_PARAMS)}) return }