Skip to content

CasaOS - A simple, easy-to-use, elegant open-source Personal Cloud system.

Allow specific special characters (#823)

link86380d912d54
diff --git a/route/v1/samba.go b/route/v1/samba.go
index bf3cdac..6c080eb 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
}