feat: add user status and path permissions
This commit is contained in:
@@ -50,6 +50,7 @@ type Account struct {
|
||||
Rules []PathRule
|
||||
Home string
|
||||
Admin bool
|
||||
Enabled bool
|
||||
}
|
||||
type Manager struct {
|
||||
Accounts map[string]*Account
|
||||
@@ -85,7 +86,7 @@ func ParseRules(values []string) (*Manager, error) {
|
||||
}
|
||||
|
||||
func (m *Manager) Authenticate(user, pwd string) *Account {
|
||||
if a, ok := m.Accounts[user]; ok && (a.Password == pwd || a.PasswordHash == PasswordHash(pwd)) {
|
||||
if a, ok := m.Accounts[user]; ok && (a.Enabled || a.PasswordHash == "") && (a.Password == pwd || a.PasswordHash == PasswordHash(pwd)) {
|
||||
return a
|
||||
}
|
||||
if user == "" && pwd == "" {
|
||||
|
||||
Reference in New Issue
Block a user