2024-04-29 12:32:58 -07:00
|
|
|
// Copyright (C) 2024 Pagefault Games - All Rights Reserved
|
|
|
|
// https://github.com/pagefaultgames
|
|
|
|
|
2024-04-14 17:03:53 -07:00
|
|
|
package account
|
|
|
|
|
|
|
|
import (
|
|
|
|
"database/sql"
|
|
|
|
"fmt"
|
|
|
|
|
2024-04-29 12:22:27 -07:00
|
|
|
"github.com/pagefaultgames/rogueserver/db"
|
2024-04-14 17:03:53 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
// /account/logout - log out of account
|
|
|
|
func Logout(token []byte) error {
|
|
|
|
err := db.RemoveSessionFromToken(token)
|
|
|
|
if err != nil {
|
|
|
|
if err == sql.ErrNoRows {
|
|
|
|
return fmt.Errorf("token not found")
|
|
|
|
}
|
|
|
|
|
|
|
|
return fmt.Errorf("failed to remove account session")
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|