mirror of
https://github.com/schollz/cowyo.git
synced 2023-08-10 21:13:00 +03:00
Prevent encrypting locked pages
Former-commit-id: 0154b3bbfe05a6a1520971a9e7019f50d2099005 [formerly 51ddb6c687c5e659293898765b6b1d3e023bcae4] [formerly d1032b8324e9d7433a4ee806c49cac43d32012a3 [formerly 66faab1fbd0b245475d19eb40bcf443d20b8ae73 [formerly41cdfda98a
]]] Former-commit-id: 21cc2358168803e11bd33ea20b60d7c86907cd17 [formerly 054bae1e71259eaf0a9866cbf33cc5214120c1d1] Former-commit-id: 2d7d6714588efd33381b80c3f4f2bf2e77b306c7 Former-commit-id:590538d8ef
This commit is contained in:
parent
bca008f315
commit
3a463449fb
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user