@@ -139,7 +139,7 @@ public function the_users_in_the_database_can_be_used_for_logging_in()
139
139
}
140
140
141
141
/** @test */
142
- public function you_can_limit_which_database_users_have_access ()
142
+ public function you_can_limit_which_database_users_have_access_using_a_comma_separated_string ()
143
143
{
144
144
$ this ->loadLaravelMigrations (['--database ' => 'testing ' ]);
145
145
@@ -183,6 +183,51 @@ public function you_can_limit_which_database_users_have_access()
183
183
])->assertRedirect ($ this ->url )->assertSessionHasErrors ('password ' );
184
184
}
185
185
186
+ /** @test */
187
+ public function you_can_limit_which_database_users_have_access_using_an_array ()
188
+ {
189
+ $ this ->loadLaravelMigrations (['--database ' => 'testing ' ]);
190
+
191
+ User::create ([
192
+ 'name ' => 'John Doe ' ,
193
+ 'email ' => 'john@doe.io ' ,
194
+ 'password ' => bcrypt ('str0ng p4ssw0rd ' ),
195
+ ]);
196
+ User::create ([
197
+ 'name ' => 'Jane Doe ' ,
198
+ 'email ' => 'jane@doe.io ' ,
199
+ 'password ' => bcrypt ('str0ng p4ssw0rd ' ),
200
+ ]);
201
+ User::create ([
202
+ 'name ' => 'Mr. Smith ' ,
203
+ 'email ' => 'mr@smith.io ' ,
204
+ 'password ' => bcrypt ('str0ng p4ssw0rd ' ),
205
+ ]);
206
+
207
+ config ()->set ('stagefront.database ' , true );
208
+ config ()->set ('stagefront.database_whitelist ' , ['john@doe.io ' , ' jane@doe.io ' ]);
209
+ config ()->set ('stagefront.database_table ' , 'users ' );
210
+ config ()->set ('stagefront.database_login_field ' , 'email ' );
211
+ config ()->set ('stagefront.database_password_field ' , 'password ' );
212
+
213
+ $ this ->enableStageFront ();
214
+
215
+ $ this ->setIntendedUrl ('/page ' )->submitForm ([
216
+ 'login ' => 'john@doe.io ' ,
217
+ 'password ' => 'str0ng p4ssw0rd ' ,
218
+ ])->assertRedirect ('/page ' );
219
+
220
+ $ this ->setIntendedUrl ('/page ' )->submitForm ([
221
+ 'login ' => 'jane@doe.io ' ,
222
+ 'password ' => 'str0ng p4ssw0rd ' ,
223
+ ])->assertRedirect ('/page ' );
224
+
225
+ $ this ->setIntendedUrl ('/page ' )->submitForm ([
226
+ 'login ' => 'mr@smith.io ' ,
227
+ 'password ' => 'str0ng p4ssw0rd ' ,
228
+ ])->assertRedirect ($ this ->url )->assertSessionHasErrors ('password ' );
229
+ }
230
+
186
231
/** @test */
187
232
public function urls_can_be_ignored_so_access_is_not_denied_by_stagefront ()
188
233
{
0 commit comments