l10n, create dir on creating file
This commit is contained in:
@@ -13,6 +13,7 @@ import (
|
||||
)
|
||||
|
||||
type AuthStore interface {
|
||||
Get(user string) bool
|
||||
Register(user, pass string) error
|
||||
Login(user, pass string) (token string, err error)
|
||||
Verify(token string) (session Session, err error)
|
||||
@@ -39,6 +40,11 @@ func New(path string, hashKey []byte) (AuthStore, error) {
|
||||
return s, err
|
||||
}
|
||||
|
||||
func (s Htpasswd) Get(user string) bool {
|
||||
_, ok := s.accounts[user]
|
||||
return ok
|
||||
}
|
||||
|
||||
func (s Htpasswd) Register(user, pass string) (err error) {
|
||||
if _, ok := s.accounts[user]; ok {
|
||||
return errors.New("user already exists")
|
||||
|
||||
Reference in New Issue
Block a user