-
Notifications
You must be signed in to change notification settings - Fork 978
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
117 changed files
with
3,090 additions
and
335 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
courier/template/courier/builtin/templates/login/sms.body.gotmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
code {{ .Code }} |
1 change: 1 addition & 0 deletions
1
courier/template/courier/builtin/templates/test_stub/sms.body.gotmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
stub sms body {{ .Body }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package sms | ||
|
||
import ( | ||
"encoding/json" | ||
"github.com/ory/kratos/courier/template" | ||
"os" | ||
) | ||
|
||
type ( | ||
CodeMessage struct { | ||
c template.Config | ||
m *CodeMessageModel | ||
} | ||
CodeMessageModel struct { | ||
To string | ||
Code string | ||
} | ||
) | ||
|
||
func NewCodeMessage(c template.Config, m *CodeMessageModel) *CodeMessage { | ||
return &CodeMessage{c: c, m: m} | ||
} | ||
|
||
func (t *CodeMessage) PhoneNumber() (string, error) { | ||
return t.m.To, nil | ||
} | ||
|
||
func (t *CodeMessage) SMSBody() (string, error) { | ||
return template.LoadText(os.DirFS(t.c.CourierTemplatesRoot()), "login/sms.body.gotmpl", "login/sms.body*", t.m) | ||
} | ||
|
||
func (t *CodeMessage) MarshalJSON() ([]byte, error) { | ||
return json.Marshal(t.m) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package sms | ||
|
||
import ( | ||
"encoding/json" | ||
"github.com/ory/kratos/courier/template" | ||
"os" | ||
|
||
"github.com/ory/kratos/driver/config" | ||
) | ||
|
||
type TestSmsStub struct { | ||
c *config.Config | ||
m *TestSmsStubModel | ||
} | ||
|
||
type TestSmsStubModel struct { | ||
Phone string | ||
Body string | ||
} | ||
|
||
func NewTestSmsStub(c *config.Config, m *TestSmsStubModel) *TestSmsStub { | ||
return &TestSmsStub{c: c, m: m} | ||
} | ||
|
||
func (t *TestSmsStub) SmsRecipientPhone() (string, error) { | ||
return t.m.Phone, nil | ||
} | ||
|
||
func (t *TestSmsStub) SmsBody() (string, error) { | ||
return template.LoadText(os.DirFS(t.c.CourierTemplatesRoot()), "test_stub/sms.body.gotmpl", "test_stub/sms.body*", t.m) | ||
} | ||
|
||
func (t *TestSmsStub) MarshalJSON() ([]byte, error) { | ||
return json.Marshal(t.m) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.