This repository has been archived by the owner on Apr 9, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
/
password_policy.go
43 lines (34 loc) · 1.52 KB
/
password_policy.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package stormpath
type PasswordPolicy struct {
resource
ResetTokenTTL int `json:"resetTokenTtl,omitempty"`
ResetEmailStatus string `json:"resetEmailStatus,omitempty"`
ResetSuccessEmailStatus string `json:"resetSuccessEmailStatus,omitempty"`
ResetEmailTemplates *EmailTemplates `json:"resetEmailTemplates,omitempty"`
ResetSuccessEmailTemplates *EmailTemplates `json:"resetSuccessEmailTemplates,omitempty"`
//TODO password strength
}
//Refresh refreshes the resource by doing a GET to the resource href endpoint
func (policy *PasswordPolicy) Refresh() error {
return client.get(policy.Href, policy)
}
//Update updates the given resource, by doing a POST to the resource Href
func (policy *PasswordPolicy) Update() error {
return client.post(policy.Href, policy, policy)
}
//GetResetEmailTemplates loads the policy ResetEmailTemplates collection and returns it
func (policy *PasswordPolicy) GetResetEmailTemplates() (*EmailTemplates, error) {
err := client.get(policy.ResetEmailTemplates.Href, policy.ResetEmailTemplates)
if err != nil {
return nil, err
}
return policy.ResetEmailTemplates, nil
}
//GetResetSuccessEmailTemplates loads the policy ResetSuccessEmailTemplates collection and returns it
func (policy *PasswordPolicy) GetResetSuccessEmailTemplates() (*EmailTemplates, error) {
err := client.get(policy.ResetSuccessEmailTemplates.Href, policy.ResetSuccessEmailTemplates)
if err != nil {
return nil, err
}
return policy.ResetSuccessEmailTemplates, nil
}