@@ -80,26 +80,36 @@ Change the auth driver in `config/auth.php` to `adldap`:
8080
8181### Usage
8282
83- In your login form, change the username form input name to the active directory attribute you'd like to
84- use to retrieve users from. For example, if I'd like to login users by their email address, then use the
85- form input name ` mail ` :
83+ #### Username Attributes
8684
87- <input type="text" name="mail" />
88-
89- <input type="password" name="password" />
85+ Inside your ` config/adldap_auth.php ` file there is a configuration option named ` username_attribute ` . The key of the
86+ array indicates the input name of your login form, and the value indicates the LDAP attribute that this references.
87+
88+ This option just allows you to set your input name to however you see fit, and allow different ways of logging in a user.
9089
91- Or, use their ` samaccountname ` attribute:
90+ In your login form, change the username form input name to your configured input name.
9291
93- <input type="text" name="samaccountname" />
92+ By default this is set to ` email ` :
93+
94+ <input type="text" name="email" />
9495
9596 <input type="password" name="password" />
9697
9798You'll also need to add the following to your AuthController if you're not overriding the default postLogin method.
9899
99- protected $username = 'samaccountname';
100+ protected $username = 'email';
101+
102+ If you'd like to use the users ` samaccountname ` to login instead, just your inputs and configuration:
103+
104+ <input type="text" name="username" />
105+
106+ <input type="password" name="password" />
100107
101- All this name represents, is how Adldap discovers the user trying to login. The actual authentication is done
102- with the ` login_attribute ` inside your ` config/adldap_auth.php ` file.
108+ Inside ` config/adldap_auth.php `
109+
110+ 'username_attribute' => ['username' => 'samaccountname'],
111+
112+ > ** Note** The actual authentication is done with the ` login_attribute ` inside your ` config/adldap_auth.php ` file.
103113
104114#### Logging In
105115
0 commit comments