mirror of
https://github.com/zitadel/zitadel.git
synced 2025-01-12 23:34:05 +00:00
fix: only show factors with state ready (#3081)
This commit is contained in:
parent
b363ddd707
commit
2592383a7c
@ -22,6 +22,10 @@ func (s *Server) ListMyAuthFactors(ctx context.Context, _ *auth_pb.ListMyAuthFac
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
err = query.AppendStateQuery(domain.MFAStateReady)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
authMethods, err := s.query.SearchUserAuthMethods(ctx, query)
|
authMethods, err := s.query.SearchUserAuthMethods(ctx, query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -24,6 +24,10 @@ func (s *Server) ListMyPasswordless(ctx context.Context, _ *auth_pb.ListMyPasswo
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
err = query.AppendStateQuery(domain.MFAStateReady)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
authMethods, err := s.query.SearchUserAuthMethods(ctx, query)
|
authMethods, err := s.query.SearchUserAuthMethods(ctx, query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -522,6 +522,10 @@ func (s *Server) ListHumanAuthFactors(ctx context.Context, req *mgmt_pb.ListHuma
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
err = query.AppendStateQuery(domain.MFAStateReady)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
authMethods, err := s.query.SearchUserAuthMethods(ctx, query)
|
authMethods, err := s.query.SearchUserAuthMethods(ctx, query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -561,6 +565,10 @@ func (s *Server) ListHumanPasswordless(ctx context.Context, req *mgmt_pb.ListHum
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
err = query.AppendStateQuery(domain.MFAStateReady)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
authMethods, err := s.query.SearchUserAuthMethods(ctx, query)
|
authMethods, err := s.query.SearchUserAuthMethods(ctx, query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -128,6 +128,10 @@ func NewUserAuthMethodTypeSearchQuery(value domain.UserAuthMethodType) (SearchQu
|
|||||||
return NewNumberQuery(UserAuthMethodColumnMethodType, value, NumberEquals)
|
return NewNumberQuery(UserAuthMethodColumnMethodType, value, NumberEquals)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func NewUserAuthMethodStateSearchQuery(value domain.MFAState) (SearchQuery, error) {
|
||||||
|
return NewNumberQuery(UserAuthMethodColumnState, value, NumberEquals)
|
||||||
|
}
|
||||||
|
|
||||||
func NewUserAuthMethodTypesSearchQuery(values ...domain.UserAuthMethodType) (SearchQuery, error) {
|
func NewUserAuthMethodTypesSearchQuery(values ...domain.UserAuthMethodType) (SearchQuery, error) {
|
||||||
list := make([]interface{}, len(values))
|
list := make([]interface{}, len(values))
|
||||||
for i, value := range values {
|
for i, value := range values {
|
||||||
@ -163,6 +167,15 @@ func (r *UserAuthMethodSearchQueries) AppendTokenIDQuery(tokenID string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *UserAuthMethodSearchQueries) AppendStateQuery(state domain.MFAState) error {
|
||||||
|
query, err := NewUserAuthMethodStateSearchQuery(state)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
r.Queries = append(r.Queries, query)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (r *UserAuthMethodSearchQueries) AppendAuthMethodQuery(authMethod domain.UserAuthMethodType) error {
|
func (r *UserAuthMethodSearchQueries) AppendAuthMethodQuery(authMethod domain.UserAuthMethodType) error {
|
||||||
query, err := NewUserAuthMethodTypeSearchQuery(authMethod)
|
query, err := NewUserAuthMethodTypeSearchQuery(authMethod)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user