Skip to content
This repository was archived by the owner on Oct 16, 2024. It is now read-only.

Commit 7645fb2

Browse files
committed
make both phone,email work with dashboard.html
1 parent afcad3f commit 7645fb2

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ module github.com/passageidentity/example-go
33
go 1.15
44

55
require (
6-
github.com/joho/godotenv v1.4.0 // indirect
7-
github.com/passageidentity/passage-go v1.1.1
6+
github.com/joho/godotenv v1.4.0
7+
github.com/passageidentity/passage-go v1.1.2
88
)

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keL
44
github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
55
github.com/joho/godotenv v1.4.0 h1:3l4+N6zfMWnkbPEXKng2o2/MR5mSwTrBih4ZEkkz1lg=
66
github.com/joho/godotenv v1.4.0/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
7-
github.com/passageidentity/passage-go v1.1.1 h1:nfc29QFPOhFrdcKr9pU5K4pVhsI+aWxtSxLSWjX4GPE=
8-
github.com/passageidentity/passage-go v1.1.1/go.mod h1:UvFvzPuSKx16jwWXti/JIaW9+3MfJw2fE+PbMV43I5I=
7+
github.com/passageidentity/passage-go v1.1.2 h1:tofMiYSzWx63ZK0dzsVyKHeIED+ame2vFRiGJbx6Ux4=
8+
github.com/passageidentity/passage-go v1.1.2/go.mod h1:bXWdkaW7wJ8Aq4qGalP22UaGxqzzud1+4nDxhJRZuPw=
99
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
1010
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
1111
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=

main.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ func dashboardHandler(w http.ResponseWriter, r *http.Request) {
6363
fmt.Println("Could not get user: ", err)
6464
return
6565
}
66-
inputArgs := map[string]interface{}{"email": user.Email}
66+
var identifier string
67+
if user.Email != "" {
68+
identifier = user.Email
69+
} else {
70+
identifier = user.Phone
71+
}
72+
inputArgs := map[string]interface{}{"identifier": identifier}
6773
outputHTML(w, "templates/dashboard.html", inputArgs)
6874
}

templates/dashboard.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<div class="bg-poly"></div>
2323

2424
<div class=header>
25-
{{.email}} signed in
25+
{{.identifier}} signed in
2626
<br>
2727
with <strong>Passage.</strong>
2828
</div>

0 commit comments

Comments
 (0)