Skip to content

Commit

Permalink
remove single case switch
Browse files Browse the repository at this point in the history
remove duplicate cases

Signed-off-by: SammyOina <sammyoina@gmail.com>
  • Loading branch information
SammyOina committed Jun 16, 2023
1 parent 55e09c1 commit 78b73ca
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 11 deletions.
4 changes: 2 additions & 2 deletions users/clients/emailer/emailer.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func New(url string, c *email.Config) (clients.Emailer, error) {
return &emailer{resetURL: url, agent: e}, err
}

func (e *emailer) SendPasswordReset(To []string, host, user, token string) error {
func (e *emailer) SendPasswordReset(to []string, host, user, token string) error {
url := fmt.Sprintf("%s%s?token=%s", host, e.resetURL, token)
return e.agent.Send(To, "", "Password Reset Request", "", user, url, "")
return e.agent.Send(to, "", "Password Reset Request", "", user, url, "")
}
5 changes: 1 addition & 4 deletions users/clients/mocks/authn.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,7 @@ func (svc authServiceMock) Identify(ctx context.Context, in *policies.Token, opt

func (svc authServiceMock) Issue(ctx context.Context, in *policies.IssueReq, opts ...grpc.CallOption) (*policies.Token, error) {
if id, ok := svc.users[in.GetEmail()]; ok {
switch in.Type {
default:
return &policies.Token{Value: id}, nil
}
return &policies.Token{Value: id}, nil
}
return nil, errors.ErrAuthentication
}
Expand Down
2 changes: 1 addition & 1 deletion users/clients/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ func (svc service) ListClients(ctx context.Context, token string, pm mfclients.P
if client.ID == id {
clients.Clients = append(clients.Clients[:i], clients.Clients[i+1:]...)
if clients.Total != 0 {
clients.Total = clients.Total - 1
clients.Total--
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions users/jwt/tokens.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ func (repo tokenRepo) Issue(ctx context.Context, claim Claims) (Token, error) {
}

return Token{
AccessToken: string(signedAccessToken[:]),
RefreshToken: string(signedRefreshToken[:]),
AccessToken: string(signedAccessToken),
RefreshToken: string(signedRefreshToken),
AccessType: "Bearer",
}, nil
}
Expand Down
1 change: 0 additions & 1 deletion users/policies/api/grpc/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ func encodeError(err error) error {
case errors.Contains(err, errors.ErrMalformedEntity),
err == apiutil.ErrInvalidAuthKey,
err == apiutil.ErrMissingID,
err == apiutil.ErrBearerToken,
err == apiutil.ErrMissingPolicySub,
err == apiutil.ErrMissingPolicyObj,
err == apiutil.ErrMalformedPolicyAct,
Expand Down
2 changes: 1 addition & 1 deletion ws/api/endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func parseSubTopic(subtopic string) (string, error) {
return "", errMalformedSubtopic
}

subtopic = strings.Replace(subtopic, "/", ".", -1)
subtopic = strings.ReplaceAll(subtopic, "/", ".")

elems := strings.Split(subtopic, ".")
filteredElems := []string{}
Expand Down

0 comments on commit 78b73ca

Please sign in to comment.