[WIP] migration to psql

TODO:
[ ] stats
[ ] indexes
This commit is contained in:
Las Zenow 2016-07-30 07:10:33 -04:00
parent e1bd235785
commit e72de38725
24 changed files with 648 additions and 936 deletions

View file

@ -21,7 +21,7 @@ func loginHandler(h handler) {
func loginPostHandler(h handler) {
user := h.r.FormValue("user")
pass := h.r.FormValue("pass")
if h.db.User(user).Valid(pass) {
if h.db.ValidPassword(user, pass) {
log.Info("User ", user, " log in")
h.sess.LogIn(user)
h.sess.Notify("Successful login!", "Welcome "+user, "success")
@ -74,12 +74,12 @@ func settingsHandler(h handler) {
pass1 := h.r.FormValue("password1")
pass2 := h.r.FormValue("password2")
switch {
case !h.db.User(h.sess.User).Valid(current_pass):
case !h.db.ValidPassword(h.sess.User, current_pass):
h.sess.Notify("Password error!", "The current password given don't match with the user password. Try again", "error")
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.User(h.sess.User).SetPassword(pass1)
h.db.SetPassword(h.sess.User, pass1)
h.sess.Notify("Password updated!", "Your new password is correctly set.", "success")
}
h.sess.Save(h.w, h.r)