(ctx context.Context, p *UserUpdateParams)
| 29 | } |
| 30 | |
| 31 | func (a *API) validateUserUpdateParams(ctx context.Context, p *UserUpdateParams) error { |
| 32 | config := a.config |
| 33 | |
| 34 | var err error |
| 35 | if p.Email != "" { |
| 36 | p.Email, err = a.validateEmail(p.Email) |
| 37 | if err != nil { |
| 38 | return err |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | if p.Phone != "" { |
| 43 | if p.Phone, err = validatePhone(p.Phone); err != nil { |
| 44 | return err |
| 45 | } |
| 46 | if p.Channel == "" { |
| 47 | p.Channel = sms_provider.SMSProvider |
| 48 | } |
| 49 | if !sms_provider.IsValidMessageChannel(p.Channel, config) { |
| 50 | return apierrors.NewBadRequestError(apierrors.ErrorCodeValidationFailed, InvalidChannelError) |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | if p.Password != nil { |
| 55 | if err := a.checkPasswordStrength(ctx, *p.Password); err != nil { |
| 56 | return err |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | return nil |
| 61 | } |
| 62 | |
| 63 | // UserGet returns a user |
| 64 | func (a *API) UserGet(w http.ResponseWriter, r *http.Request) error { |
no test coverage detected