示例#1
0
func (admin *Admin) SetPassword(password string) bool {
	if admin.id == 0 {
		return false
	} else {
		database.Connect()
		defer database.Close()
		dk, salt := util.NuevaContraseña(password)
		database.ExecuteNonQuery("UPDATE Admin SET Password = ?, Salt = ? WHERE id = ?", dk, salt, admin.id)
		return true
	}
}
示例#2
0
func (doc *Doctor) SetPassword(password string) bool {
	if doc.id == 0 {
		return false
	} else {
		database.Connect()
		defer database.Close()
		dk, salt := util.NuevaContraseña(password)
		database.ExecuteNonQuery("UPDATE doctores SET Password = ?, Salt = ? WHERE Id = ?", dk, salt, doc.id)
		return true
	}
}