Documentation
¶
Overview ¶
Package service holds business logic that outlives any one HTTP handler. Today that is authentication: registration, login and the password rules, kept here so the web and API layers apply the same ones.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrEmailTaken = errors.New("email already registered") ErrInvalidCredentials = errors.New("invalid credentials") )
Functions ¶
This section is empty.
Types ¶
type AuthService ¶
type AuthService struct {
// contains filtered or unexported fields
}
AuthService handles authentication logic.
func NewAuthService ¶
func NewAuthService(store repo.Store) *AuthService
NewAuthService creates a new auth service.
func (*AuthService) Authenticate ¶
Authenticate verifies credentials and returns the user.
func (*AuthService) ChangePassword ¶
func (s *AuthService) ChangePassword(ctx context.Context, userID, current, next string) error
ChangePassword swaps a user's password after verifying the current one. The current-password check is what stops a stolen session from locking the real owner out of their own account.
Click to show internal directories.
Click to hide internal directories.