diff options
author | George Goldberg <george@gberg.me> | 2018-02-06 17:25:53 +0000 |
---|---|---|
committer | George Goldberg <george@gberg.me> | 2018-02-06 17:25:53 +0000 |
commit | 7941c30117efe1b957ac0458c2f0479e3824196d (patch) | |
tree | df791632a9dc790a6f73dec53aae3ba919ebda63 /model/authorize.go | |
parent | e1cd64613591cf5a990442a69ebf188258bd0cb5 (diff) | |
parent | 034dbc07e3068c482e654b6a1a8fcbe4b01c44f3 (diff) | |
download | chat-7941c30117efe1b957ac0458c2f0479e3824196d.tar.gz chat-7941c30117efe1b957ac0458c2f0479e3824196d.tar.bz2 chat-7941c30117efe1b957ac0458c2f0479e3824196d.zip |
Merge branch 'master' into advanced-permissions-phase-1
Diffstat (limited to 'model/authorize.go')
-rw-r--r-- | model/authorize.go | 38 |
1 files changed, 10 insertions, 28 deletions
diff --git a/model/authorize.go b/model/authorize.go index df07ff142..2296e7e22 100644 --- a/model/authorize.go +++ b/model/authorize.go @@ -115,43 +115,25 @@ func (ad *AuthData) PreSave() { } func (ad *AuthData) ToJson() string { - b, err := json.Marshal(ad) - if err != nil { - return "" - } else { - return string(b) - } + b, _ := json.Marshal(ad) + return string(b) } func AuthDataFromJson(data io.Reader) *AuthData { - decoder := json.NewDecoder(data) - var ad AuthData - err := decoder.Decode(&ad) - if err == nil { - return &ad - } else { - return nil - } + var ad *AuthData + json.NewDecoder(data).Decode(&ad) + return ad } func (ar *AuthorizeRequest) ToJson() string { - b, err := json.Marshal(ar) - if err != nil { - return "" - } else { - return string(b) - } + b, _ := json.Marshal(ar) + return string(b) } func AuthorizeRequestFromJson(data io.Reader) *AuthorizeRequest { - decoder := json.NewDecoder(data) - var ar AuthorizeRequest - err := decoder.Decode(&ar) - if err == nil { - return &ar - } else { - return nil - } + var ar *AuthorizeRequest + json.NewDecoder(data).Decode(&ar) + return ar } func (ad *AuthData) IsExpired() bool { |