Fixed registration handler
This commit is contained in:
parent
7420047491
commit
aadc6e8a03
|
@ -126,7 +126,12 @@ func NewActivation(code string) error {
|
|||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue