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:
parent
b6a9c44bce
commit
41cdfda98a
@ -75,7 +75,7 @@ func handlePageRequest(c *gin.Context) {
|
|||||||
p.Update("*This page has now self-destructed.*\n\n" + p.Text.GetCurrent())
|
p.Update("*This page has now self-destructed.*\n\n" + p.Text.GetCurrent())
|
||||||
p.Erase()
|
p.Erase()
|
||||||
}
|
}
|
||||||
if command == "/erase" && !p.IsLocked {
|
if command == "/erase" && !p.IsLocked && !p.IsEncrypted {
|
||||||
p.Erase()
|
p.Erase()
|
||||||
c.Redirect(302, "/"+page+"/edit")
|
c.Redirect(302, "/"+page+"/edit")
|
||||||
return
|
return
|
||||||
@ -219,6 +219,10 @@ func handleEncrypt(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
p := Open(json.Page)
|
p := Open(json.Page)
|
||||||
|
if p.IsLocked {
|
||||||
|
c.JSON(http.StatusOK, gin.H{"success": false, "message": "Locked"})
|
||||||
|
return
|
||||||
|
}
|
||||||
q := Open(json.Page)
|
q := Open(json.Page)
|
||||||
var message string
|
var message string
|
||||||
if p.IsEncrypted {
|
if p.IsEncrypted {
|
||||||
|
Loading…
Reference in New Issue
Block a user