Slightly nicer UI for LDAP login test

This commit is contained in:
snipe 2017-10-16 06:39:36 -07:00
parent f1a6926ad9
commit b107280b7b
2 changed files with 12 additions and 4 deletions

View file

@ -107,11 +107,15 @@ class SettingsController extends Controller
try {
$connection = Ldap::connectToLdap();
try {
\Log::debug('attempting to bind to LDAP for LDAP test');
\Log::debug('Attempting to bind to LDAP for LDAP test');
Ldap::bindAdminToLdap($connection);
try {
$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) {
\Log::debug('LDAP login failed');
return response()->json(['message' => $e->getMessage()], 400);

View file

@ -361,11 +361,15 @@
<div class="col-md-3">
<a class="btn btn-default btn-sm" id="ldaptestlogin" style="margin-right: 10px;">Test LDAP</a>
</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="ldaptestloginstatus"></span>
</div>
</div>
<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>
</div>