Merge pull request #963 from appwrite/fix-933-country-name-unknown-for-sessions
Use uppercase countryCode as index for $countries assoc array
This commit is contained in:
commit
e22d35b827
3 changed files with 9 additions and 6 deletions
|
@ -6,7 +6,7 @@
|
|||
|
||||
## Features
|
||||
|
||||
- Better error logs on appwrite cretificates worker
|
||||
- Better error logs on appwrite certificates worker
|
||||
- Added option for Redis authentication
|
||||
- Force adding a security email on setup
|
||||
- SMTP is now disabled by default, no dummy SMTP is included in setup
|
||||
|
@ -28,6 +28,7 @@
|
|||
|
||||
- Updated missing storage env vars
|
||||
- Fixed a bug, that Response format header was not added in the access-control-allow-header list.
|
||||
- Fixed a bug where countryName is unknown on sessions (#933)
|
||||
|
||||
## Security
|
||||
|
||||
|
|
|
@ -236,9 +236,11 @@ App::post('/v1/account/sessions')
|
|||
->setStatusCode(Response::STATUS_CODE_CREATED)
|
||||
;
|
||||
|
||||
$countries = $locale->getText('countries');
|
||||
|
||||
$session
|
||||
->setAttribute('current', true)
|
||||
->setAttribute('countryName', (isset($countries[$session->getAttribute('countryCode')])) ? $countries[$session->getAttribute('countryCode')] : $locale->getText('locale.country.unknown'))
|
||||
->setAttribute('countryName', (isset($countries[strtoupper($session->getAttribute('countryCode'))])) ? $countries[strtoupper($session->getAttribute('countryCode'))] : $locale->getText('locale.country.unknown'))
|
||||
;
|
||||
|
||||
$response->dynamic($session, Response::MODEL_SESSION);
|
||||
|
@ -679,8 +681,8 @@ App::get('/v1/account/sessions')
|
|||
continue;
|
||||
}
|
||||
|
||||
$token->setAttribute('countryName', (isset($countries[$token->getAttribute('contryCode')]))
|
||||
? $countries[$token->getAttribute('contryCode')]
|
||||
$token->setAttribute('countryName', (isset($countries[strtoupper($token->getAttribute('countryCode'))]))
|
||||
? $countries[strtoupper($token->getAttribute('countryCode'))]
|
||||
: $locale->getText('locale.country.unknown'));
|
||||
$token->setAttribute('current', ($current == $token->getId()) ? true : false);
|
||||
|
||||
|
|
|
@ -205,8 +205,8 @@ App::get('/v1/users/:userId/sessions')
|
|||
continue;
|
||||
}
|
||||
|
||||
$token->setAttribute('countryName', (isset($countries[$token->getAttribute('contryCode')]))
|
||||
? $countries[$token->getAttribute('contryCode')]
|
||||
$token->setAttribute('countryName', (isset($countries[strtoupper($token->getAttribute('contryCode'))]))
|
||||
? $countries[strtoupper($token->getAttribute('contryCode'))]
|
||||
: $locale->getText('locale.country.unknown'));
|
||||
$token->setAttribute('current', false);
|
||||
|
||||
|
|
Loading…
Reference in a new issue