diff --git a/lib/database/users.go b/lib/database/users.go index 0909bd4..ad46164 100644 --- a/lib/database/users.go +++ b/lib/database/users.go @@ -74,8 +74,8 @@ func (db *pgDB) SetPassword(name string, pass string) error { if err != nil { return err } - _, err = db.sql.Model(user{}). - Set("pass = ?, salt = ?", hash, salt). + _, err = db.sql.Model(&user{}). + Set("password = ?, salt = ?", hash, salt). Where("username = ?", name). Update() return err diff --git a/lib/user.go b/lib/user.go index 8f20dc2..4657f7e 100644 --- a/lib/user.go +++ b/lib/user.go @@ -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) }