Library support for optional email
This commit is contained in:
parent
2c24056374
commit
ee2c7f3ad7
1 changed files with 9 additions and 3 deletions
|
@ -107,10 +107,16 @@ func NewClient(caURL string, usr User, keyBits int, optPort string) (*Client, er
|
||||||
func (c *Client) Register() (*RegistrationResource, error) {
|
func (c *Client) Register() (*RegistrationResource, error) {
|
||||||
logger().Print("Registering account ... ")
|
logger().Print("Registering account ... ")
|
||||||
|
|
||||||
jsonBytes, err := json.Marshal(registrationMessage{
|
regMsg := registrationMessage{
|
||||||
Resource: "new-reg",
|
Resource: "new-reg",
|
||||||
Contact: []string{"mailto:" + c.user.GetEmail()},
|
}
|
||||||
})
|
if c.user.GetEmail() != "" {
|
||||||
|
regMsg.Contact = []string{"mailto:" + c.user.GetEmail()}
|
||||||
|
} else {
|
||||||
|
regMsg.Contact = []string{}
|
||||||
|
}
|
||||||
|
|
||||||
|
jsonBytes, err := json.Marshal(regMsg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue