connector/login: normalize phone number on finalize

Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
This commit is contained in:
Sumner Evans
2024-09-09 21:47:19 -06:00
parent 777225c252
commit cd0d940889
+3 -1
View File
@@ -19,6 +19,7 @@ package connector
import (
"context"
"fmt"
"strings"
"github.com/gotd/td/tg"
"maunium.net/go/mautrix/bridge/status"
@@ -92,9 +93,10 @@ func finalizeLogin(ctx context.Context, user *bridgev2.User, authorization *tg.A
if username == "" && len(me.Usernames) > 0 {
username = me.Usernames[0].Username
}
normalizedPhone := "+" + strings.TrimPrefix(me.Phone, "+")
remoteName := username
if remoteName == "" {
remoteName = me.Phone
remoteName = normalizedPhone
}
if remoteName == "" {
remoteName = fullName