Fix setting password

We were not acting on the error returning, and the sql sintax was wrong.
This commit is contained in:
Las Zenow 2018-02-22 09:57:37 +00:00
parent 22065852b2
commit de58f0251e
2 changed files with 9 additions and 4 deletions

View file

@ -79,8 +79,13 @@ func settingsHandler(h handler) {
case pass1 != pass2:
h.sess.Notify("Passwords don't match!", "The new password and the confirmation password don't match. Try again", "error")
default:
h.db.SetPassword(h.sess.User, pass1)
h.sess.Notify("Password updated!", "Your new password is correctly set.", "success")
err := h.db.SetPassword(h.sess.User, pass1)
if err != nil {
log.Warn("Can't update password for user ", h.sess.User, ": ", err)
h.sess.Notify("Password error!", "An error has ocurred updating the password in the database. Sorry.", "error")
} else {
h.sess.Notify("Password updated!", "Your new password is correctly set.", "success")
}
}
h.sess.Save(h.w, h.r)
}