Documentation ¶
Index ¶
- func LoginUser(sess *sessions.Session, uR *UserRepository, username string, password string) (bool, error)
- func ValidateLogin(username string, password string) error
- func ValidatePasswordChange(uR *UserRepository, user User, currentPassword string, newPassword string, ...) error
- func ValidateUpdate(uR *UserRepository, user User) error
- type User
- type UserRepository
- func (uR *UserRepository) ByEmail(email string) User
- func (uR *UserRepository) ByID(usernameID uint) User
- func (uR *UserRepository) ByUsername(username string) User
- func (uR *UserRepository) NewUser(username string, firstName string, lastName string, email string, ...) (User, error)
- func (uR *UserRepository) Save(user *User)
- func (uR *UserRepository) Update(user *User) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoginUser ¶
func LoginUser(sess *sessions.Session, uR *UserRepository, username string, password string) (bool, error)
LoginUser tries to login a user using given credentials
func ValidateLogin ¶
ValidateLogin validates a user using given credentials
func ValidatePasswordChange ¶
func ValidatePasswordChange( uR *UserRepository, user User, currentPassword string, newPassword string, passwordConfirmation string) error
ValidatePasswordChange validates a password change given current password, new password and confirmed password
func ValidateUpdate ¶
func ValidateUpdate(uR *UserRepository, user User) error
ValidateUpdate validates the new values for a user
Types ¶
type User ¶
type User struct { gorm.Model Username string Email string Password string FirstName string LastName string // contains filtered or unexported fields }
User model
type UserRepository ¶
UserRepository type
func (*UserRepository) ByEmail ¶
func (uR *UserRepository) ByEmail(email string) User
ByEmail returns a User object that has a given email address
func (*UserRepository) ByID ¶
func (uR *UserRepository) ByID(usernameID uint) User
ByID returns a User object that has the provided id
func (*UserRepository) ByUsername ¶
func (uR *UserRepository) ByUsername(username string) User
ByUsername returns a User object that has a given username
func (*UserRepository) NewUser ¶
func (uR *UserRepository) NewUser( username string, firstName string, lastName string, email string, password string, passwordVerification string) (User, error)
NewUser creates validates input and creates a new user instance
func (*UserRepository) Save ¶
func (uR *UserRepository) Save(user *User)
Save persists to database a User type
func (*UserRepository) Update ¶
func (uR *UserRepository) Update(user *User) error
Update persists to database changes for a user model
Click to show internal directories.
Click to hide internal directories.