🎨 Little code formatting
This commit is contained in:
parent
b5c29dd553
commit
0cecea8d13
3 changed files with 6 additions and 9 deletions
|
@ -39,12 +39,8 @@ func (uc *authUseCase) Generate(ctx context.Context, opts auth.GenerateOptions)
|
|||
// information in the token is not guaranteed and is completely optional:
|
||||
// https://indieauth.net/source/#profile-information
|
||||
if opts.Scope.Has(domain.ScopeProfile) {
|
||||
userInfo, _ = uc.profiles.Get(ctx, opts.Me)
|
||||
|
||||
// NOTE(toby3d): 'email' Scope depends on 'profile'
|
||||
// Scope. Hide the email field if this information has
|
||||
// not been requested.
|
||||
if userInfo != nil && userInfo.Email != nil && !opts.Scope.Has(domain.ScopeEmail) {
|
||||
if userInfo, err = uc.profiles.Get(ctx, opts.Me); err == nil &&
|
||||
userInfo.Email != nil && !opts.Scope.Has(domain.ScopeEmail) {
|
||||
userInfo.Email = nil
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,8 +29,8 @@ type (
|
|||
NewTokenOptions struct {
|
||||
Expiration time.Duration
|
||||
Issuer *ClientID
|
||||
Subject *Me
|
||||
Profile *Profile
|
||||
Subject *Me
|
||||
Scope Scopes
|
||||
Secret []byte
|
||||
Algorithm string
|
||||
|
@ -52,7 +52,7 @@ var DefaultNewTokenOptions = NewTokenOptions{
|
|||
}
|
||||
|
||||
// NewToken create a new token by provided options.
|
||||
//nolint: cyclop
|
||||
//nolint: funlen,cyclop
|
||||
func NewToken(opts NewTokenOptions) (*Token, error) {
|
||||
if opts.NonceLength == 0 {
|
||||
opts.NonceLength = DefaultNewTokenOptions.NonceLength
|
||||
|
|
|
@ -86,7 +86,8 @@ func (repo *httpProfileRepository) Get(ctx context.Context, me *domain.Me) (*dom
|
|||
}
|
||||
}
|
||||
|
||||
if result.GetName() == "" && result.GetURL() == nil && result.GetPhoto() == nil && result.GetEmail() == nil {
|
||||
if result.GetName() == "" && result.GetURL() == nil &&
|
||||
result.GetPhoto() == nil && result.GetEmail() == nil {
|
||||
return nil, profile.ErrNotExist
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue