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

Fix: Bug with decryption

This commit is contained in:
Zack Scholl 2017-03-21 21:10:41 -06:00
parent 5a923ae11a
commit 6012c92c96
2 changed files with 7 additions and 4 deletions

View File

@ -159,16 +159,17 @@ func handleEncrypt(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{"success": false, "message": "Wrong password"})
return
}
p.IsEncrypted = false
p.Erase()
p = Open(json.Page)
p.Update(decrypted)
p.IsEncrypted = false
message = "Decrypted"
} else {
p.IsEncrypted = true
currentText := p.Text.GetCurrent()
p.Erase()
p = Open(json.Page)
encrypted, _ := EncryptString(p.Text.GetCurrent(), json.Passphrase)
p.IsEncrypted = true
encrypted, _ := EncryptString(currentText, json.Passphrase)
p.Update(encrypted)
message = "Encrypted"
}

View File

@ -162,7 +162,9 @@
}),
success: function(data) {
$('#saveEditButton').text(data.message);
window.location = "/{{ .Page }}/view";
if (data.success == true) {
window.location = "/{{ .Page }}/view";
}
},
error: function(xhr, error) {
$('#saveEditButton').text(error);