1
0
mirror of https://github.com/schollz/cowyo.git synced 2023-08-10 21:13:00 +03:00

Prevent encrypting locked pages

This commit is contained in:
Zack Scholl 2017-03-22 13:37:59 -06:00
parent b6a9c44bce
commit 41cdfda98a

View File

@ -75,7 +75,7 @@ func handlePageRequest(c *gin.Context) {
p.Update("*This page has now self-destructed.*\n\n" + p.Text.GetCurrent())
p.Erase()
}
if command == "/erase" && !p.IsLocked {
if command == "/erase" && !p.IsLocked && !p.IsEncrypted {
p.Erase()
c.Redirect(302, "/"+page+"/edit")
return
@ -219,6 +219,10 @@ func handleEncrypt(c *gin.Context) {
return
}
p := Open(json.Page)
if p.IsLocked {
c.JSON(http.StatusOK, gin.H{"success": false, "message": "Locked"})
return
}
q := Open(json.Page)
var message string
if p.IsEncrypted {