Beispiel #1
0
// DeleteAccount checks if the supplied password is correct and then
// deletes the account
func (controller *Settings) DeleteAccount() {
	password := strings.TrimSpace(controller.GetString("password"))
	account := controller.Account
	isPasswordValid := auth.VerifyAccount(account, password)
	if isPasswordValid {
		controller.Account.Delete()
	} else {
		controller.Abort("404")
	}
	controller.ShowBlankPage()
}
Beispiel #2
0
// Delete deletes the entire subject and data related to it
// It requires the admin password
func (controller *Subject) Delete() {
	password := strings.TrimSpace(controller.GetString("password"))
	isPasswordValid := auth.VerifyAccount(controller.Account, password)
	if isPasswordValid {
		err := controller.subject.Delete()
		if err != nil {
			controller.DisplaySimpleError(err.Error())
		} else {
			message := "Wisply deleted all the information related to [" + controller.subject.GetName() + "] !"
			goTo := "/admin/education/"
			controller.DisplaySuccessMessage(message, goTo)
		}
	} else {
		controller.Redirect("/admin/education", 404)
	}
}