dont delete admin if DEMO_MODE

pull/805/head
hunterlong 2020-09-01 12:47:32 -07:00
parent a451db51f1
commit 793017f336
2 changed files with 11 additions and 1 deletions

View File

@ -1,7 +1,8 @@
# 0.90.65 (08-24-2020)
# 0.90.65 (09-01-2020)
- Fixed issue with dashboard not logging in (notifier panic)
- Modified static email templates to github.com/statping/emails
- Modified Regenerate API function to keep API_SECRET env
- Added DEMO_MODE env variable, if true, 'admin' cannot be deleted
# 0.90.64 (08-18-2020)
- Modified max-width for container to 1012px, larger UI

View File

@ -14,6 +14,15 @@ func (u *User) Validate() error {
return nil
}
func (u *User) BeforeDelete() error {
if utils.Params.GetBool("DEMO_MODE") {
if u.Username == "admin" {
return errors.New("cannot delete admin in DEMO_MODE")
}
}
return nil
}
func (u *User) BeforeCreate() error {
if err := u.Validate(); err != nil {
return err