EmailClear decrypts and returns the user's email, caching it in the user object.
(keys *key.Keychain)
| 93 | // EmailClear decrypts and returns the user's email, caching it in the user |
| 94 | // object. |
| 95 | func (u *User) EmailClear(keys *key.Keychain) string { |
| 96 | if u.clearEmail != "" { |
| 97 | return u.clearEmail |
| 98 | } |
| 99 | |
| 100 | if u.Email.Valid && u.Email.String != "" { |
| 101 | email, err := data.Decrypt(keys.EmailKey, []byte(u.Email.String)) |
| 102 | if err != nil { |
| 103 | log.Error("Error decrypting user email: %v", err) |
| 104 | } else { |
| 105 | u.clearEmail = string(email) |
| 106 | return u.clearEmail |
| 107 | } |
| 108 | } |
| 109 | return "" |
| 110 | } |
| 111 | |
| 112 | func (u User) CreatedFriendly() string { |
| 113 | /* |
no outgoing calls
no test coverage detected