Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #15067 - updated ldap sync locale to use app()->getLocale() #15084

Merged
merged 4 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/Console/Commands/LdapSync.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ public function handle()
// Creating a new user.
$user = new User;
$user->password = $user->noPassword();
$user->locale = app()->getLocale();
$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)
$item['createorupdate'] = 'created';
}
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Middleware/CheckLocale.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function handle($request, Closure $next, $guard = null)

}

\App::setLocale(Helper::mapLegacyLocale($language));
app()->setLocale(Helper::mapLegacyLocale($language));
return $next($request);
}
}
4 changes: 3 additions & 1 deletion app/Models/Ldap.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ public static function parseAndMapLdapAttributes($ldapattributes)
$item['department'] = $ldapattributes[$ldap_result_dept][0] ?? '';
$item['manager'] = $ldapattributes[$ldap_result_manager][0] ?? '';
$item['location'] = $ldapattributes[$ldap_result_location][0] ?? '';
$item['locale'] = app()->getLocale();

return $item;
}
Expand All @@ -239,7 +240,7 @@ public static function parseAndMapLdapAttributes($ldapattributes)
* @author [A. Gianotto] [<snipe@snipe.net>]
* @since [v3.0]
* @param $ldapatttibutes
* @return array|bool
* @return User | bool
*/
public static function createUserFromLdap($ldapatttibutes, $password)
{
Expand All @@ -252,6 +253,7 @@ public static function createUserFromLdap($ldapatttibutes, $password)
$user->last_name = $item['lastname'];
$user->username = $item['username'];
$user->email = $item['email'];
$user->locale = $item['locale'];
$user->password = $user->noPassword();

if (Setting::getSettings()->ldap_pw_sync == '1') {
Expand Down
Loading