fix: check length of site name and site description
This commit is contained in:
parent
191146ac7c
commit
c202911fc8
2 changed files with 5 additions and 2 deletions
|
@ -63,6 +63,7 @@ export class TopBar extends React.Component<Props, State, {}> {
|
|||
href="https://github.com/ihexxa/quickshare"
|
||||
target="_blank"
|
||||
className="h5 bold"
|
||||
title={this.props.ui.clientCfg.siteDesc}
|
||||
>
|
||||
{this.props.ui.clientCfg.siteName}
|
||||
</a>,
|
||||
|
|
|
@ -83,8 +83,10 @@ func (h *SettingsSvc) SetClientCfg(c *gin.Context) {
|
|||
}
|
||||
|
||||
func validateClientCfg(cfg *db.ClientConfig) error {
|
||||
if cfg.SiteName == "" {
|
||||
return errors.New("site name is empty")
|
||||
if len(cfg.SiteName) == 0 || len(cfg.SiteName) >= 12 {
|
||||
return errors.New("site name is too short or too long")
|
||||
} else if len(cfg.SiteDesc) >= 64 {
|
||||
return errors.New("site description is too short or too long")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue