diff --git a/database.go b/database.go index 662860c..ce880e3 100644 --- a/database.go +++ b/database.go @@ -89,6 +89,11 @@ func (d *DB) UserValid(user string, pass string) bool { return n != 0 } +func (d *DB) AddUser(user string, pass string) error { + hash := md5Pass(pass) + return d.user.Insert(bson.M{"user": user, "pass": hash, "role": ""}) +} + func (d *DB) UserRole(user string) string { type result struct { Role string diff --git a/templates/header.html b/templates/header.html index 78a68d5..1fbe133 100644 --- a/templates/header.html +++ b/templates/header.html @@ -16,6 +16,7 @@