Skip to content

Commit

Permalink
fix(siteinfo): set default login config
Browse files Browse the repository at this point in the history
  • Loading branch information
LinkinStars committed Dec 13, 2023
1 parent 935ed47 commit ae6d98a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions internal/migrations/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ func (m *Mentor) InitDB() error {
m.do("init site info seo config", m.initSiteInfoSEOConfig)
m.do("init site info user config", m.initSiteInfoUsersConfig)
m.do("init site info privilege rank", m.initSiteInfoPrivilegeRank)
m.do("init site info write", m.initSiteInfoWrite)
return m.err
}

Expand Down Expand Up @@ -179,6 +180,7 @@ func (m *Mentor) initSiteInfoLoginConfig() {
loginConfig := map[string]bool{
"allow_new_registrations": true,
"allow_email_registrations": true,
"allow_password_login": true,
"login_required": m.userData.LoginRequired,
}
loginConfigDataBytes, _ := json.Marshal(loginConfig)
Expand Down Expand Up @@ -241,3 +243,15 @@ func (m *Mentor) initSiteInfoPrivilegeRank() {
Status: 1,
})
}

func (m *Mentor) initSiteInfoWrite() {
writeData := map[string]interface{}{
"restrict_answer": true,
}
writeDataBytes, _ := json.Marshal(writeData)
_, m.err = m.engine.Context(m.ctx).Insert(&entity.SiteInfo{
Type: "write",
Content: string(writeDataBytes),
Status: 1,
})
}

0 comments on commit ae6d98a

Please sign in to comment.