mirror of
https://github.com/snipe/snipe-it.git
synced 2025-02-02 08:21:09 -08:00
Merge branch 'develop'
This commit is contained in:
commit
8638c46b1d
|
@ -107,11 +107,15 @@ class SettingsController extends Controller
|
||||||
try {
|
try {
|
||||||
$connection = Ldap::connectToLdap();
|
$connection = Ldap::connectToLdap();
|
||||||
try {
|
try {
|
||||||
\Log::debug('attempting to bind to LDAP for LDAP test');
|
\Log::debug('Attempting to bind to LDAP for LDAP test');
|
||||||
Ldap::bindAdminToLdap($connection);
|
Ldap::bindAdminToLdap($connection);
|
||||||
try {
|
try {
|
||||||
$ldap_user = Ldap::findAndBindUserLdap($request->input('ldaptest_user'), $request->input('ldaptest_password'));
|
$ldap_user = Ldap::findAndBindUserLdap($request->input('ldaptest_user'), $request->input('ldaptest_password'));
|
||||||
return response()->json(['message' => 'It worked! '. $request->input('username').' successfully binded to LDAP.'], 200);
|
if ($ldap_user) {
|
||||||
|
return response()->json(['message' => 'It worked! '. $request->input('username').' successfully binded to LDAP.'], 200);
|
||||||
|
}
|
||||||
|
return response()->json(['message' => 'Login Failed. '. $request->input('username').' successfully binded to LDAP.'], 400);
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
\Log::debug('LDAP login failed');
|
\Log::debug('LDAP login failed');
|
||||||
return response()->json(['message' => $e->getMessage()], 400);
|
return response()->json(['message' => $e->getMessage()], 400);
|
||||||
|
|
|
@ -361,11 +361,15 @@
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<a class="btn btn-default btn-sm" id="ldaptestlogin" style="margin-right: 10px;">Test LDAP</a>
|
<a class="btn btn-default btn-sm" id="ldaptestlogin" style="margin-right: 10px;">Test LDAP</a>
|
||||||
</div>
|
</div>
|
||||||
<span id="ldaptestloginicon"></span>
|
<span id="ldaptestloginicon"></span>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-9 col-md-offset-3">
|
||||||
|
|
||||||
<span id="ldaptestloginresult"></span>
|
<span id="ldaptestloginresult"></span>
|
||||||
<span id="ldaptestloginstatus"></span>
|
<span id="ldaptestloginstatus"></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<div class="col-md-9 col-md-offset-3">
|
<div class="col-md-9 col-md-offset-3">
|
||||||
<p class="help-block">Enter a valid LDAP username and password to test whether your LDAP login is configured correctly.</p>
|
<p class="help-block">Enter a valid LDAP username and password to test whether your LDAP login is configured correctly.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue