all repos — flounder @ 2dba5119bb2fc790b6efdb5983d1f3d5c3926229

A small site builder for the Gemini protocol

auth.go (view raw)

 1package main
 2
 3import "golang.org/x/crypto/bcrypt"
 4
 5func checkAuth(user string, password string) error {
 6	var actualPass []byte
 7	row := DB.QueryRow("SELECT password_hash FROM user where username = ?", user)
 8	err := row.Scan(&actualPass)
 9	if err != nil {
10		return err
11	}
12	err = bcrypt.CompareHashAndPassword(actualPass, []byte(password))
13	return err
14}