Skip to content

Commit

Permalink
fixes issue
Browse files Browse the repository at this point in the history
  • Loading branch information
rishabhpoddar committed May 27, 2024
1 parent 634da75 commit 82d8ac6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/auth-react-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,22 @@ func callSTInit(passwordlessConfig *plessmodels.TypeInput) {
return saveCode(input.PasswordlessLogin.PhoneNumber, input.PasswordlessLogin.UserInputCode, input.PasswordlessLogin.UrlWithLinkCode, input.PasswordlessLogin.CodeLifetime, input.PasswordlessLogin.PreAuthSessionId, userContext)
}

sendPasswordlessLoginEmail := func(input emaildelivery.EmailType, userContext supertokens.UserContext) error {
return saveCode(input.PasswordlessLogin.Email, input.PasswordlessLogin.UserInputCode, input.PasswordlessLogin.UrlWithLinkCode, input.PasswordlessLogin.CodeLifetime, input.PasswordlessLogin.PreAuthSessionId, userContext)
}

if passwordlessConfig == nil {
passwordlessConfig = &plessmodels.TypeInput{
SmsDelivery: &smsdelivery.TypeInput{
Service: &smsdelivery.SmsDeliveryInterface{
SendSms: &sendPasswordlessLoginSms,
},
},
EmailDelivery: &emaildelivery.TypeInput{
Service: &emaildelivery.EmailDeliveryInterface{
SendEmail: &sendPasswordlessLoginEmail,
},
},
ContactMethodEmailOrPhone: plessmodels.ContactMethodEmailOrPhoneConfig{
Enabled: true,
},
Expand Down Expand Up @@ -414,6 +423,7 @@ func callSTInit(passwordlessConfig *plessmodels.TypeInput) {
rw.Write(bytes)
} else if r.URL.Path == "/beforeeach" && r.Method == "POST" {
deviceStore = map[string]CustomDevice{}
callSTInit(nil)
rw.WriteHeader(200)
rw.Header().Add("content-type", "application/json")
bytes, _ := json.Marshal(map[string]interface{}{})
Expand Down

0 comments on commit 82d8ac6

Please sign in to comment.