-
Notifications
You must be signed in to change notification settings - Fork 970
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement account recovery skeleton (#294)
This patch implements the account recovery request skeleton with endpoints such as "Init Account Recovery", a new config value `urls�.recovery_ui` and so on. Additionally, some refactoring was made to DRY code and make naming consistent. See #37 BREAKING CHANGEs: The field `identity.addresses` has moved to `identity.verifiable_addresses`. A new field has been added `identity.recovery_addresses`. Configuration key `selfservice.verify` was renamed to `selfservice.verification`. Configuration key `selfservice.verification.link_lifespan` has been merged with `selfservice.verification.request_lifespan`.
- Loading branch information
Showing
25,728 changed files
with
2,487,886 additions
and
272 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v0 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package template | ||
|
||
import ( | ||
"path/filepath" | ||
|
||
"github.com/ory/kratos/driver/configuration" | ||
) | ||
|
||
type ( | ||
RecoverInvalid struct { | ||
c configuration.Provider | ||
m *RecoverInvalidModel | ||
} | ||
RecoverInvalidModel struct { | ||
To string | ||
} | ||
) | ||
|
||
func NewRecoverInvalid(c configuration.Provider, m *RecoverInvalidModel) *RecoverInvalid { | ||
return &RecoverInvalid{c: c, m: m} | ||
} | ||
|
||
func (t *RecoverInvalid) EmailRecipient() (string, error) { | ||
return t.m.To, nil | ||
} | ||
|
||
func (t *RecoverInvalid) EmailSubject() (string, error) { | ||
return loadTextTemplate(filepath.Join(t.c.CourierTemplatesRoot(), "recover/invalid/email.subject.gotmpl"), t.m) | ||
} | ||
|
||
func (t *RecoverInvalid) EmailBody() (string, error) { | ||
return loadTextTemplate(filepath.Join(t.c.CourierTemplatesRoot(), "recover/invalid/email.body.gotmpl"), 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,24 @@ | ||
package template_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
|
||
"github.com/ory/kratos/courier/template" | ||
"github.com/ory/kratos/internal" | ||
) | ||
|
||
func TestRecoverInvalid(t *testing.T) { | ||
conf, _ := internal.NewFastRegistryWithMocks(t) | ||
tpl := template.NewRecoverInvalid(conf, &template.RecoverInvalidModel{}) | ||
|
||
rendered, err := tpl.EmailBody() | ||
require.NoError(t, err) | ||
assert.NotEmpty(t, rendered) | ||
|
||
rendered, err = tpl.EmailSubject() | ||
require.NoError(t, err) | ||
assert.NotEmpty(t, rendered) | ||
} |
Oops, something went wrong.