Documentation ¶
Index ¶
- type AccountManager
- func (am *AccountManager) AddCharacter(userID string, characterID string) (messages.Account, messages.AMErrorType)
- func (am *AccountManager) ComparePasswords(hashedPassword, password string) bool
- func (am *AccountManager) CreateAccount(username, password, discordTag string) messages.AccountRegistrationResponse
- func (am *AccountManager) DiscordExists(discordID string) (*messages.Account, messages.AMErrorType)
- func (am *AccountManager) DiscordTagExists(discordTag string) (*messages.Account, messages.AMErrorType)
- func (am *AccountManager) HandleMessages(started chan bool)
- func (am *AccountManager) HashPassword(password string) (string, error)
- func (am *AccountManager) Init() error
- func (am *AccountManager) Start(started chan bool) error
- func (am *AccountManager) UpdateAccount(account messages.Account) error
- func (am *AccountManager) UpdateAccountField(field string, value interface{}, account messages.Account) error
- func (am *AccountManager) UpdateLoginCharacterHistory(info messages.CharacterInfo) messages.Account
- func (am *AccountManager) UsernameExists(username string) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountManager ¶
type AccountManager struct { ReceiveChannel chan messages.AccountManagerMessage // We only receive player manager messages SendChannel chan messages.ConnectionManagerMessage // We only send connection manager messages Log logging.LoggerType EB edenbot.EdenBot DB edendb.DatabaseType }
func NewAccountManager ¶
func NewAccountManager(receiveChannel chan messages.AccountManagerMessage, sendChannel chan messages.ConnectionManagerMessage, db edendb.DatabaseType, log logging.LoggerType, edenbot edenbot.EdenBot) *AccountManager
func (*AccountManager) AddCharacter ¶
func (am *AccountManager) AddCharacter(userID string, characterID string) (messages.Account, messages.AMErrorType)
func (*AccountManager) ComparePasswords ¶
func (am *AccountManager) ComparePasswords(hashedPassword, password string) bool
ComparePasswords compares a password with a hash using bcrypt.CompareHashAndPassword
func (*AccountManager) CreateAccount ¶
func (am *AccountManager) CreateAccount(username, password, discordTag string) messages.AccountRegistrationResponse
CreateAccount creates a new account, returns nil on success or error on failure
func (*AccountManager) DiscordExists ¶
func (am *AccountManager) DiscordExists(discordID string) (*messages.Account, messages.AMErrorType)
DiscordExists checks if a discord id is already registered to an account
func (*AccountManager) DiscordTagExists ¶
func (am *AccountManager) DiscordTagExists(discordTag string) (*messages.Account, messages.AMErrorType)
DiscordTagExists checks if a discord tag is already registered to an account
func (*AccountManager) HandleMessages ¶
func (am *AccountManager) HandleMessages(started chan bool)
func (*AccountManager) HashPassword ¶
func (am *AccountManager) HashPassword(password string) (string, error)
HashPassword uses bcrypt.GenerateFromPassword to hash a password
func (*AccountManager) Init ¶
func (am *AccountManager) Init() error
Init initializes the database for the account manager if needed
func (*AccountManager) Start ¶
func (am *AccountManager) Start(started chan bool) error
func (*AccountManager) UpdateAccount ¶
func (am *AccountManager) UpdateAccount(account messages.Account) error
UpdateAccount updates the provided account in the database
func (*AccountManager) UpdateAccountField ¶
func (am *AccountManager) UpdateAccountField(field string, value interface{}, account messages.Account) error
func (*AccountManager) UpdateLoginCharacterHistory ¶
func (am *AccountManager) UpdateLoginCharacterHistory(info messages.CharacterInfo) messages.Account
func (*AccountManager) UsernameExists ¶
func (am *AccountManager) UsernameExists(username string) (bool, error)
UsernameExists checks if a username is already in use
Click to show internal directories.
Click to hide internal directories.