Skip to content

Commit 2187929

Browse files
committed
fix: remove unreachable SSO-binding branch in networkCreateSeedphrase
networkCreateSeedphrase's only caller (NetworkCreate) guards entry on networkCreate.AuthJwt == nil, so the "if AuthJwt provided, bind SSO too" branch inside it could never execute -- dead code that also silently swallowed a bind error via glog.Infof had it ever run, which would have been a latent trap if the outer guard were ever loosened later.
1 parent 37eb4cd commit 2187929

1 file changed

Lines changed: 0 additions & 19 deletions

File tree

model/network_model.go

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -892,25 +892,6 @@ func networkCreateSeedphrase(
892892
err = CreateSeedphraseAuthInTx(tx, ctx, createdUserId, seedphrase)
893893
server.Raise(err)
894894

895-
// if SSO provided, bind it too
896-
if networkCreate.AuthJwt != nil && networkCreate.AuthJwtType != nil {
897-
authJwt, _ := ParseAuthJwt(*networkCreate.AuthJwt, AuthType(*networkCreate.AuthJwtType))
898-
if authJwt != nil {
899-
err = addSsoAuthInTx(
900-
tx, ctx,
901-
&AddSsoAuthArgs{
902-
UserId: createdUserId,
903-
AuthJwt: *networkCreate.AuthJwt,
904-
ParsedAuthJwt: *authJwt,
905-
AuthJwtType: SsoAuthType(*networkCreate.AuthJwtType),
906-
},
907-
)
908-
if err != nil {
909-
glog.Infof("[net]seedphrase create + sso bind error: %s\n", err)
910-
}
911-
}
912-
}
913-
914895
_, err = tx.Exec(
915896
ctx,
916897
`INSERT INTO network (network_id, network_name, admin_user_id)

0 commit comments

Comments
 (0)