mirror of https://github.com/statping/statping
dont delete admin if DEMO_MODE
parent
a451db51f1
commit
793017f336
|
@ -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)
|
- Fixed issue with dashboard not logging in (notifier panic)
|
||||||
- Modified static email templates to github.com/statping/emails
|
- Modified static email templates to github.com/statping/emails
|
||||||
- Modified Regenerate API function to keep API_SECRET env
|
- 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)
|
# 0.90.64 (08-18-2020)
|
||||||
- Modified max-width for container to 1012px, larger UI
|
- Modified max-width for container to 1012px, larger UI
|
||||||
|
|
|
@ -14,6 +14,15 @@ func (u *User) Validate() error {
|
||||||
return nil
|
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 {
|
func (u *User) BeforeCreate() error {
|
||||||
if err := u.Validate(); err != nil {
|
if err := u.Validate(); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in New Issue