indentalUserDB: properly handle data with colons
This commit is contained in:
parent
b364581c6e
commit
4d62b07047
1 changed files with 3 additions and 3 deletions
|
@ -185,7 +185,7 @@ func readDB(filePath string) (map[string]*auth.User, error) {
|
|||
if strings.Contains(l, ":") {
|
||||
kvp := strings.Split(l, ":")
|
||||
k := strings.TrimSpace(kvp[0])
|
||||
v := strings.TrimSpace(kvp[1])
|
||||
v := strings.TrimSpace(strings.Join(kvp[1:], ":"))
|
||||
switch k {
|
||||
case "pass":
|
||||
pass = v
|
||||
|
@ -241,8 +241,8 @@ func writeDB(filePath string, users map[string]*auth.User) error {
|
|||
user.Name,
|
||||
user.Pass,
|
||||
user.Session,
|
||||
user.LoginTime.Format(timeFmt),
|
||||
user.LastSeen.Format(timeFmt)))
|
||||
user.LoginTime.UTC().Format(timeFmt),
|
||||
user.LastSeen.UTC().Format(timeFmt)))
|
||||
for k, v := range user.Data {
|
||||
f.WriteString(fmt.Sprintf("\t\t%s: %s\n", k, v))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue