mirror of
https://github.com/Terncode/pixel.horse.git
synced 2026-12-03 05:10:04 +01:00
Check age when joining 18+ servers
This commit is contained in:
1 parent
a0bb9b2fbb
commit
661dc4e654
1 file changed
+6
-1
@@ -4,7 +4,8 @@ import { UserError } from '../userError';
|
||||
import { InternalGameServerState } from '../../common/adminInterfaces';
|
||||
import { JoinResponse } from '../../common/interfaces';
|
||||
import { meetsRequirement } from '../../common/accountUtils';
|
||||
import { supporterLevel } from '../../common/adminUtils';
|
||||
import { supporterLevel, getAge } from '../../common/adminUtils';
|
||||
import { MIN_ADULT_AGE } from '../../common/constants';
|
||||
import { isServerOffline } from '../serverUtils';
|
||||
import { getAccountAlertMessage } from '../accountUtils';
|
||||
|
||||
@@ -63,6 +64,10 @@ export const createJoinGame =
|
||||
throw new UserError('Server is restricted');
|
||||
}
|
||||
|
||||
if (server.state.alert === '18+' && !(account.birthdate && getAge(account.birthdate) >= MIN_ADULT_AGE)) {
|
||||
throw new UserError('Server is restricted');
|
||||
}
|
||||
|
||||
if (!characterId || typeof characterId !== 'string') {
|
||||
throw new UserError('Invalid data', { message: 'Invalid pony ID', desc: `"${characterId}"` });
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user