From 3b244d673b18157b66192e7ef4245cd25b7a03aa Mon Sep 17 00:00:00 2001 From: Michael Jerger Date: Fri, 9 Feb 2024 16:24:51 +0100 Subject: [PATCH] small fixes --- go.mod | 6 +----- models/user/user_repository.go | 3 ++- modules/forgefed/federation_service.go | 4 ++-- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index 5ca531282d..9da4968e3e 100644 --- a/go.mod +++ b/go.mod @@ -101,6 +101,7 @@ require ( github.com/yuin/goldmark v1.6.0 github.com/yuin/goldmark-highlighting/v2 v2.0.0-20230729083705-37449abec8cc github.com/yuin/goldmark-meta v1.1.0 + github.com/valyala/fastjson v1.6.4 golang.org/x/crypto v0.18.0 golang.org/x/image v0.15.0 golang.org/x/net v0.20.0 @@ -119,11 +120,6 @@ require ( xorm.io/xorm v1.3.7 ) -require ( - github.com/sethvargo/go-password v0.2.0 - github.com/valyala/fastjson v1.6.4 -) - require ( cloud.google.com/go/compute v1.23.3 // indirect cloud.google.com/go/compute/metadata v0.2.3 // indirect diff --git a/models/user/user_repository.go b/models/user/user_repository.go index aead02970c..ee1f6dd6d2 100644 --- a/models/user/user_repository.go +++ b/models/user/user_repository.go @@ -51,7 +51,8 @@ func CreateFederatedUser(ctx context.Context, user *User, federatedUser *Federat } func FindFederatedUser(ctx context.Context, externalID string, - federationHostID int64) (*User, *FederatedUser, error) { + federationHostID int64, +) (*User, *FederatedUser, error) { federatedUser := new(FederatedUser) user := new(User) has, err := db.GetEngine(ctx).Where("external_id=? and federation_host_id=?", externalID, federationHostID).Get(federatedUser) diff --git a/modules/forgefed/federation_service.go b/modules/forgefed/federation_service.go index bf6fa39aca..a4dec26052 100644 --- a/modules/forgefed/federation_service.go +++ b/modules/forgefed/federation_service.go @@ -13,13 +13,13 @@ import ( "code.gitea.io/gitea/models/repo" "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/modules/activitypub" + "code.gitea.io/gitea/modules/auth/password" "code.gitea.io/gitea/modules/context" "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/validation" "github.com/google/uuid" - pwd_gen "github.com/sethvargo/go-password/password" ) func LikeActivity(ctx *context.APIContext, form any, repositoryId int64) (error, int, string) { @@ -165,7 +165,7 @@ func CreateUserFromAP(ctx *context.APIContext, personID forgefed.PersonID, feder if len(person.Name) == 0 { fullName = name } - password, err := pwd_gen.Generate(32, 10, 10, false, true) + password, err := password.Generate(32) if err != nil { return nil, nil, err }