mirror of
https://github.com/schollz/cowyo.git
synced 2023-08-10 21:13:00 +03:00
Prevent locking encrypted
This commit is contained in:
parent
41cdfda98a
commit
59af266a12
17
handlers.go
17
handlers.go
@ -75,10 +75,15 @@ 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 && !p.IsEncrypted {
|
if command == "/erase" {
|
||||||
p.Erase()
|
if !p.IsLocked && !p.IsEncrypted {
|
||||||
c.Redirect(302, "/"+page+"/edit")
|
p.Erase()
|
||||||
return
|
c.Redirect(302, "/"+page+"/edit")
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
c.Redirect(302, "/"+page+"/view")
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
rawText := p.Text.GetCurrent()
|
rawText := p.Text.GetCurrent()
|
||||||
rawHTML := p.RenderedPage
|
rawHTML := p.RenderedPage
|
||||||
@ -189,6 +194,10 @@ func handleLock(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
p := Open(json.Page)
|
p := Open(json.Page)
|
||||||
|
if p.IsEncrypted {
|
||||||
|
c.JSON(http.StatusOK, gin.H{"success": false, "message": "Encrypted"})
|
||||||
|
return
|
||||||
|
}
|
||||||
var message string
|
var message string
|
||||||
if p.IsLocked {
|
if p.IsLocked {
|
||||||
err2 := CheckPasswordHash(json.Passphrase, p.PassphraseToUnlock)
|
err2 := CheckPasswordHash(json.Passphrase, p.PassphraseToUnlock)
|
||||||
|
Loading…
Reference in New Issue
Block a user