Fixed registration handler

This commit is contained in:
Nefrace 2024-07-08 20:18:07 +03:00
parent 7420047491
commit aadc6e8a03
1 changed files with 6 additions and 1 deletions

View File

@ -126,7 +126,12 @@ func NewActivation(code string) error {
} }
func UseActivation(code string) bool { func UseActivation(code string) bool {
_, err := db.Exec(`delete from activations where code = $1`, code) exists := false
err := db.Get(&exists, `SELECT exists(SELECT 1 FROM chats WHERE code = $1);`, code)
if err != nil || !exists {
return false
}
_, err = db.Exec(`delete from activations where code = $1`, code)
return err == nil return err == nil
} }