Merge branch 'develop'

This commit is contained in:
snipe 2017-10-16 06:40:15 -07:00
commit 8638c46b1d
2 changed files with 12 additions and 4 deletions

View file

@ -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'));
if ($ldap_user) {
return response()->json(['message' => 'It worked! '. $request->input('username').' successfully binded to LDAP.'], 200); 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);

View file

@ -362,10 +362,14 @@
<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>