MCPcopy Index your code
hub / github.com/supabase/auth / validateUserUpdateParams

Method validateUserUpdateParams

internal/api/user.go:31–61  ·  view source on GitHub ↗
(ctx context.Context, p *UserUpdateParams)

Source from the content-addressed store, hash-verified

29}
30
31func (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
64func (a *API) UserGet(w http.ResponseWriter, r *http.Request) error {

Callers 1

UserUpdateMethod · 0.95

Calls 5

validateEmailMethod · 0.95
checkPasswordStrengthMethod · 0.95
IsValidMessageChannelFunction · 0.92
NewBadRequestErrorFunction · 0.92
validatePhoneFunction · 0.85

Tested by

no test coverage detected