- Claims - libphonenumber > invalidate number region
@@ -0,0 +1,14 @@
+package model
+
+import "github.com/mitchellh/mapstructure"
+type Claims struct {
+ Email string `mapstructure:"email"`
+ Sub string `mapstructure:"sub"`
+ Scope string `mapstructure:"scope"`
+ SessionId string `mapstructure:"sid"`
+}
+func (c *Claims) Unmarshall(source map[string]any) error {
+ return mapstructure.Decode(source, c)
@@ -47,6 +47,12 @@ func NewPhoneNumber(number, region string, verified bool) (*Phone, error) {
return nil, err
}
+ if p.number.CountryCode != nil {
+ if cc := phonenumbers.GetRegionCodeForCountryCode(int(*p.number.CountryCode)); cc != p.PhoneRegion {
+ p.PhoneRegion = cc
+ }
return &p, nil