mirror of
https://blitiri.com.ar/repos/chasquid
synced 2025-12-17 14:37:02 +00:00
Normalize local usernames using PRECIS
This patch implements local username normalization using PRECIS (https://tools.ietf.org/html/rfc7564, https://tools.ietf.org/html/rfc7613) It makes chasquid accept local email and authentication regardless of the case. It covers both userdb and aliases. Note that non-local usernames remain untouched.
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
|
||||
"blitiri.com.ar/go/chasquid/internal/aliases"
|
||||
"blitiri.com.ar/go/chasquid/internal/config"
|
||||
"blitiri.com.ar/go/chasquid/internal/normalize"
|
||||
"blitiri.com.ar/go/chasquid/internal/userdb"
|
||||
|
||||
"github.com/docopt/docopt-go"
|
||||
@@ -77,9 +78,14 @@ func AddUser() {
|
||||
}
|
||||
}
|
||||
|
||||
user, err := normalize.User(args["<username>"].(string))
|
||||
if err != nil {
|
||||
Fatalf("Error normalizing user: %v", err)
|
||||
}
|
||||
|
||||
password := getPassword()
|
||||
|
||||
err = db.AddUser(args["<username>"].(string), password)
|
||||
err = db.AddUser(user, password)
|
||||
if err != nil {
|
||||
Fatalf("Error adding user: %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user