func (a *Admin) User(username, password string) error {
	if len(username) == 0 || len(password) == 0 {
		return errors.New("Username and/or password is missing")
	}
	a.username = username
	a.password = password
	return nil
}
User sets username and password for the admin panel. This will change in the future, when support for custom login backends
is implemented. No promises on when that will happen, though.
package admin
import (
	"database/sql"
	"errors"
	"fmt"
	"html/template"
	"net/http"
	"os"
	"reflect"
	"github.com/extemporalgenome/slug"
	_ "github.com/mattn/go-sqlite3"
	"github.com/oal/admin/db"
	"github.com/oal/admin/fields"
)
type NameTransformFunc func(string) string
type Admin struct {
	Title string
	NameTransform NameTransformFunc
	path      string
	username  string
	password  string
	sessions  map[string]*session
	urls      *urlConfig
	db        *sql.DB
	dialect   db.Dialect
	sourceDir string
	models         map[string]*model
	modelGroups    []*modelGroup
	registeredRels map[reflect.Type]*model
	missingRels    map[fields.RelationalField]reflect.Type
}
func New(path, dbDriver, dbSource string) (*Admin, error) {
	admin := &Admin{}
	err := admin.database(dbDriver, dbSource)
	if err != nil {
		return nil, err
	}
	admin.sourceDir = fmt.Sprintf("%v/src/github.com/oal/admin", os.Getenv("GOPATH"))
	admin.path = path
	admin.Title = "Admin"
	admin.sessions = map[string]*session{}
	admin.models = map[string]*model{}
	admin.modelGroups = []*modelGroup{}
	admin.registeredRels = map[reflect.Type]*model{}
	admin.missingRels = map[fields.RelationalField]reflect.Type{}
	return admin, nil
}
func (a *Admin) SourceDir(dir string) error {
	if _, err := os.Stat(fmt.Sprintf("%v/templates/", dir)); err != nil {
		return err
	}
	a.sourceDir = dir
	return nil
}