server: username isn't too long to fit token

This commit is contained in:
Tulir Asokan 2024-10-15 01:08:23 +03:00
parent 89ece7fb45
commit d3fef15c56
2 changed files with 3 additions and 1 deletions

View file

@ -80,6 +80,8 @@ func (gmx *Gomuks) LoadConfig() error {
_, err = fmt.Scanln(&gmx.Config.Web.Username) _, err = fmt.Scanln(&gmx.Config.Web.Username)
if err != nil { if err != nil {
return fmt.Errorf("failed to read username: %w", err) return fmt.Errorf("failed to read username: %w", err)
} else if len(gmx.Config.Web.Username) == 0 || len(gmx.Config.Web.Username) > 32 {
return fmt.Errorf("username must be 1-32 characters long")
} }
fmt.Print("Password: ") fmt.Print("Password: ")
var passwd string var passwd string

View file

@ -83,7 +83,7 @@ type tokenData struct {
} }
func (gmx *Gomuks) validateAuth(token string) bool { func (gmx *Gomuks) validateAuth(token string) bool {
if len(token) > 100 { if len(token) > 500 {
return false return false
} }
parts := strings.Split(token, ".") parts := strings.Split(token, ".")