mirror of
https://github.com/steveiliop56/tinyauth.git
synced 2026-02-26 02:41:59 +00:00
fix: do not append domains to users that have an email as the username
This commit is contained in:
@@ -2,6 +2,8 @@ package utils
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/mail"
|
||||
"strings"
|
||||
|
||||
"github.com/steveiliop56/tinyauth/internal/config"
|
||||
@@ -90,3 +92,13 @@ func ParseUser(userStr string) (config.User, error) {
|
||||
|
||||
return user, nil
|
||||
}
|
||||
|
||||
func CompileUserEmail(username string, domain string) string {
|
||||
_, err := mail.ParseAddress(username)
|
||||
|
||||
if err != nil {
|
||||
return fmt.Sprintf("%s@%s", strings.ToLower(username), domain)
|
||||
}
|
||||
|
||||
return username
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user