feat: disallow {} in member names
This commit is contained in:
parent
a33f39afe5
commit
3f003b5353
|
@ -35,7 +35,7 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
// member names must match this regex
|
// member names must match this regex
|
||||||
var memberNameRegex = regexp.MustCompile("^[^@\\?!#/\\\\[\\]\"'$%&()+<=>^|~`,]{1,100}$")
|
var memberNameRegex = regexp.MustCompile("^[^@\\?!#/\\\\[\\]\"\\{\\}'$%&()+<=>^|~`,]{1,100}$")
|
||||||
|
|
||||||
func MemberNameValid(name string) bool {
|
func MemberNameValid(name string) bool {
|
||||||
return memberNameRegex.MatchString(name)
|
return memberNameRegex.MatchString(name)
|
||||||
|
|
|
@ -80,7 +80,7 @@ func (s *Server) createMember(w http.ResponseWriter, r *http.Request) (err error
|
||||||
if !db.MemberNameValid(cmr.Name) {
|
if !db.MemberNameValid(cmr.Name) {
|
||||||
return server.APIError{
|
return server.APIError{
|
||||||
Code: server.ErrBadRequest,
|
Code: server.ErrBadRequest,
|
||||||
Details: "Member name cannot contain any of the following: @, ?, !, #, /, \\, [, ], \", ', $, %, &, (, ), +, <, =, >, ^, |, ~, `, ,",
|
Details: "Member name cannot contain any of the following: @, ?, !, #, /, \\, [, ], \", ', $, %, &, (, ), {, }, +, <, =, >, ^, |, ~, `, ,",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
export const memberNameRegex = /^[^@\\?!#/\\\\[\]"'$%&()+<=>^|~`,]{1,100}$/;
|
export const memberNameRegex = /^[^@\\?!#/\\\\[\]"\\{\\}'$%&()+<=>^|~`,]{1,100}$/;
|
||||||
export const usernameRegex = /^[\w-.]{2,40}$/;
|
export const usernameRegex = /^[\w-.]{2,40}$/;
|
||||||
|
|
|
@ -274,7 +274,7 @@
|
||||||
<p class="text-muted my-2">
|
<p class="text-muted my-2">
|
||||||
<Icon name="info-circle-fill" aria-label="Info" /> Your members must have distinct names. Member
|
<Icon name="info-circle-fill" aria-label="Info" /> Your members must have distinct names. Member
|
||||||
names must be 100 characters long at most, and cannot contain the following characters: @ ?
|
names must be 100 characters long at most, and cannot contain the following characters: @ ?
|
||||||
! # / \ [ ] " ' $ % & ( ) + < = > ^ | ~ ` and ,
|
! # / \ [ ] " ' $ % & ( ) { } + < = > ^ | ~ ` and ,
|
||||||
</p>
|
</p>
|
||||||
{#if newMemberError}
|
{#if newMemberError}
|
||||||
<ErrorAlert error={newMemberError} />
|
<ErrorAlert error={newMemberError} />
|
||||||
|
|
Loading…
Reference in New Issue