Beispiel #1
0
func AuthenticateAdmin(nombre string, password string) bool {
	database.Connect()
	defer database.Close()
	cifra := util.NuevoCifrador()
	nombree := cifra.Encrypt([]byte(nombre))
	rows := database.ExecuteQuery("SELECT Password, Salt FROM Admin WHERE Nombre = ?", nombree)
	rows.Next()
	var passwordbd, salt []byte
	rows.Scan(&passwordbd, &salt)
	return util.CheckPassword(password, passwordbd, salt)
}
Beispiel #2
0
func AuthenticateDoctor(dni string, password string) bool {
	database.Connect()
	defer database.Close()
	cifra := util.NuevoCifrador()
	dnie := cifra.Encrypt([]byte(dni))
	rows := database.ExecuteQuery("SELECT Password, Salt FROM doctores WHERE DNI = ?", dnie)
	rows.Next()
	var passwordbd, salt []byte
	rows.Scan(&passwordbd, &salt)
	return util.CheckPassword(password, passwordbd, salt)
}