mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 17:45:40 -05:00
Assign pt-BR or zh-HANS for those domains
This commit is contained in:
parent
1819911551
commit
b4f500333f
1 changed files with 2 additions and 0 deletions
|
@ -202,6 +202,8 @@ module.exports.makeNewUser = makeNewUser = (req) ->
|
|||
user.set 'testGroupNumber', Math.floor(Math.random() * 256) # also in app/core/auth
|
||||
lang = languages.languageCodeFromAcceptedLanguages req.acceptedLanguages
|
||||
user.set 'preferredLanguage', lang if lang[...2] isnt 'en'
|
||||
user.set 'preferredLanguage', 'pt-BR' if not user.get('preferredLanguage') and /br\.codecombat\.com/.test(req.get('host'))
|
||||
user.set 'preferredLanguage', 'zh-HANS' if not user.get('preferredLanguage') and /cn\.codecombat\.com/.test(req.get('host'))
|
||||
user.set 'lastIP', (req.headers['x-forwarded-for'] or req.connection.remoteAddress)?.split(/,? /)[0]
|
||||
user.set 'chinaVersion', true if req.chinaVersion
|
||||
#log.info "making new user #{user.get('_id')} with language #{user.get('preferredLanguage')} of #{req.acceptedLanguages} and chinaVersion #{req.chinaVersion} on #{if config.tokyo then 'Tokyo' else 'US'} server and lastIP #{req.connection.remoteAddress}."
|
||||
|
|
Loading…
Reference in a new issue