model

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Pass int = iota
	LoginExpired
	TokenExpired
	WrongToken
)

Variables

This section is empty.

Functions

func AccountRegister

func AccountRegister(usrRepo repo.UserRepoInterface, usr *object.User) (bool, error)

AccountRegister registers a new user account. It takes a user repository interface and a user object as parameters. It converts the user object to a DAO (Data Access Object) and calls the Register method on the repository. It returns a boolean indicating whether the registration was successful and an error if any.

func AuthenticateUser

func AuthenticateUser(usrRepo repo.UserRepoInterface, loginTimeRepo repo.LoginTimeInterface, usr *object.User) (bool, error)

AuthenticateUser authenticates a user. It takes a user repository interface, a login time repository interface, and a user object as parameters. It retrieves the user's password hash from the repository and compares it with the provided password. If the password is correct, it sets the login time and returns true. If the password is incorrect, it returns false and an error.

func CertifyOauthAccount

func CertifyOauthAccount(loginTimeRepo repo.LoginTimeInterface, ctx context.Context, account string) int

func CertifyToken

func CertifyToken(loginTimeRepo repo.LoginTimeInterface, ctx context.Context, token string) (int, string)

func CheckExistsID

func CheckExistsID(usrRepo repo.UserRepoInterface, usr *object.User) (bool, error)

func CreateTable

func CreateTable(usrRepo repo.UserRepoInterface) (bool, error)

func GetUserInfo

func GetUserInfo(client custintfa.Client, accessToken string) (*response.UserInfo, error)

GetUserInfo retrieves user information from the OAuth2 provider.

func Oauth2UpdateLoginTime

func Oauth2UpdateLoginTime(userInfo *response.UserInfo, usrRepo repo.UserRepoInterface, loginTimeRepo repo.LoginTimeInterface) error

func UpdatePassword

func UpdatePassword(usrRepo repo.UserRepoInterface, updatePassword *request.UpdateUserPassword) (bool, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL