mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-14 07:55:33 +01:00
Merge pull request #111 from ZeruLight/feature/moderation
feature/moderation
This commit is contained in:
@@ -244,6 +244,15 @@ func (s *Server) validateLogin(user string, pass string) (uint32, RespID) {
|
||||
return 0, SIGN_EABORT
|
||||
} else {
|
||||
if bcrypt.CompareHashAndPassword([]byte(passDB), []byte(pass)) == nil {
|
||||
var bans int
|
||||
err = s.db.QueryRow(`SELECT count(*) FROM bans WHERE user_id=$1 AND expires IS NULL`, uid).Scan(&bans)
|
||||
if err == nil && bans > 0 {
|
||||
return uid, SIGN_EELIMINATE
|
||||
}
|
||||
err = s.db.QueryRow(`SELECT count(*) FROM bans WHERE user_id=$1 AND expires > now()`, uid).Scan(&bans)
|
||||
if err == nil && bans > 0 {
|
||||
return uid, SIGN_ESUSPEND
|
||||
}
|
||||
return uid, SIGN_SUCCESS
|
||||
}
|
||||
return 0, SIGN_EPASS
|
||||
|
||||
Reference in New Issue
Block a user