Skip to content

Commit

Permalink
client: resolved that secrets can not be set when using http or cli
Browse files Browse the repository at this point in the history
  • Loading branch information
Aeneas Rekkas (arekkas) committed Jun 14, 2016
1 parent 8593699 commit 769a9d3
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions client/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,14 @@ func (h *Handler) Create(w http.ResponseWriter, r *http.Request, _ httprouter.Pa
return
}

secret, err := sequence.RuneSequence(12, []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_-.,:;$%!&/()=?+*#<>"))
if err != nil {
h.H.WriteError(ctx, w, r, errors.New(err))
return
if len(c.Secret) < 6 {
secret, err := sequence.RuneSequence(12, []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_-.,:;$%!&/()=?+*#<>"))
if err != nil {
h.H.WriteError(ctx, w, r, errors.New(err))
return
}
c.Secret = []byte(string(secret))
}
c.Secret = []byte(string(secret))

if err := h.Manager.CreateClient(&c); err != nil {
h.H.WriteError(ctx, w, r, err)
Expand Down

0 comments on commit 769a9d3

Please sign in to comment.