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

Fix: Bug with decryption

Former-commit-id: 7fcbc62027b94ec7203cd3bc176db254a5ea4ed6 [formerly 141ae1267e555901984e9b170eafe924189f1d1e] [formerly 7361c4f5dd2331ec3dd9f86326ae43daa0f66afc [formerly 6012c92c96]]
Former-commit-id: 6d89689ca47ca7a1e7b3d1a3dbbee40c055c527d [formerly 6a9175f0309bf4727ed1f5bab0e428fa6652894c]
Former-commit-id: 4210e389bed5bdc229818dce1f1af023c7803ad7
This commit is contained in:
Zack Scholl 2017-03-21 21:10:41 -06:00
parent 79422d1fb3
commit 97edbd73a8
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);