Proper check for paste's password input. Fixes #4 and should also fix #5.

This commit is contained in:
Stanislav Nikitin 2018-05-26 12:09:53 +05:00
parent 9f0beb7e3e
commit d7e9865c91

View File

@ -342,11 +342,11 @@ func pastePOST(ec echo.Context) error {
paste.Private = false
privateCheckbox, privateCheckboxFound := params["paste-private"]
pastePassword, pastePasswordFound := params["paste-password"]
if privateCheckboxFound && privateCheckbox[0] == "on" || pastePasswordFound && len(pastePassword[0]) != 0 {
if privateCheckboxFound && privateCheckbox[0] == "on" || pastePasswordFound && pastePassword[0] != "" {
paste.Private = true
}
if len(pastePassword) != 0 {
if pastePassword[0] != "" {
paste.CreatePassword(pastePassword[0])
}