mirror of
https://github.com/CPunch/gopenfusion.git
synced 2025-10-20 16:10:19 +00:00
test: started internal/db test cases
- we use github.com/bitcomplete/sqltestutil to spin up a postgresql container to test against - minor error variable refactoring
This commit is contained in:
@@ -81,7 +81,7 @@ func (server *LoginServer) Login(peer *protocol.CNPeer, pkt protocol.Packet) err
|
||||
|
||||
// attempt login
|
||||
account, err := server.dbHndlr.TryLogin(loginPkt.SzID, loginPkt.SzPassword)
|
||||
if err == db.LoginErrorInvalidID {
|
||||
if err == db.ErrLoginInvalidID {
|
||||
// this is the default behavior, auto create the account if the ID isn't in use
|
||||
account, err = server.dbHndlr.NewAccount(loginPkt.SzID, loginPkt.SzPassword)
|
||||
if err != nil {
|
||||
@@ -89,7 +89,7 @@ func (server *LoginServer) Login(peer *protocol.CNPeer, pkt protocol.Packet) err
|
||||
SendError(LOGIN_DATABASE_ERROR)
|
||||
return err
|
||||
}
|
||||
} else if err == db.LoginErrorInvalidPassword {
|
||||
} else if err == db.ErrLoginInvalidPassword {
|
||||
// respond with invalid password
|
||||
SendError(LOGIN_ID_AND_PASSWORD_DO_NOT_MATCH)
|
||||
return nil
|
||||
|
Reference in New Issue
Block a user