Skip to content

Commit 0ac82fb

Browse files
authored
Merge pull request #15084 from snipe/fixes_ldap_sync_locale
Fixes #15067 - updated ldap sync locale to use `app()->getLocale()`
2 parents 8c5a9fa + ab6b8f5 commit 0ac82fb

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

app/Console/Commands/LdapSync.php

+1
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ public function handle()
251251
// Creating a new user.
252252
$user = new User;
253253
$user->password = $user->noPassword();
254+
$user->locale = app()->getLocale();
254255
$user->activated = 1; // newly created users can log in by default, unless AD's UAC is in use, or an active flag is set (below)
255256
$item['createorupdate'] = 'created';
256257
}

app/Http/Middleware/CheckLocale.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function handle($request, Closure $next, $guard = null)
4545

4646
}
4747

48-
\App::setLocale(Helper::mapLegacyLocale($language));
48+
app()->setLocale(Helper::mapLegacyLocale($language));
4949
return $next($request);
5050
}
5151
}

app/Models/Ldap.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ public static function parseAndMapLdapAttributes($ldapattributes)
229229
$item['department'] = $ldapattributes[$ldap_result_dept][0] ?? '';
230230
$item['manager'] = $ldapattributes[$ldap_result_manager][0] ?? '';
231231
$item['location'] = $ldapattributes[$ldap_result_location][0] ?? '';
232+
$item['locale'] = app()->getLocale();
232233

233234
return $item;
234235
}
@@ -239,7 +240,7 @@ public static function parseAndMapLdapAttributes($ldapattributes)
239240
* @author [A. Gianotto] [<[email protected]>]
240241
* @since [v3.0]
241242
* @param $ldapatttibutes
242-
* @return array|bool
243+
* @return User | bool
243244
*/
244245
public static function createUserFromLdap($ldapatttibutes, $password)
245246
{
@@ -252,6 +253,7 @@ public static function createUserFromLdap($ldapatttibutes, $password)
252253
$user->last_name = $item['lastname'];
253254
$user->username = $item['username'];
254255
$user->email = $item['email'];
256+
$user->locale = $item['locale'];
255257
$user->password = $user->noPassword();
256258

257259
if (Setting::getSettings()->ldap_pw_sync == '1') {

0 commit comments

Comments
 (0)