diff --git a/app/Listeners/SendUserPasswordEmail.php b/app/Listeners/SendUserPasswordEmail.php index 3204358..81ab3e4 100644 --- a/app/Listeners/SendUserPasswordEmail.php +++ b/app/Listeners/SendUserPasswordEmail.php @@ -30,7 +30,7 @@ class SendUserPasswordEmail */ public function handle(UserCreating $event) { - $password = Str::random(config('auth.password_requirements.users.min_length')); + $password = Str::random(config('auth.password_requirements.min_length')); $event->user->password = Hash::make($password); Mail::to($event->user)->send(new UserPassword($event->user, $password)); } diff --git a/config/auth.php b/config/auth.php index 3a54923..543ec2d 100644 --- a/config/auth.php +++ b/config/auth.php @@ -14,8 +14,8 @@ return [ */ 'defaults' => [ - 'guard' => 'web', - 'passwords' => 'users', + 'guard' => 'associates', + 'passwords' => 'associates', ], /* @@ -36,14 +36,19 @@ return [ */ 'guards' => [ - 'web' => [ + 'associates' => [ 'driver' => 'session', - 'provider' => 'users', + 'provider' => 'associates', + ], + + 'collaborators' => [ + 'driver' => 'session', + 'provider' => 'collaborators', ], 'api' => [ 'driver' => 'token', - 'provider' => 'users', + 'provider' => 'collaborators', 'hash' => false, ], ], @@ -66,15 +71,15 @@ return [ */ 'providers' => [ - 'users' => [ + 'associates' => [ 'driver' => 'eloquent', - 'model' => App\User::class, + 'model' => App\Associate::class, ], - // 'users' => [ - // 'driver' => 'database', - // 'table' => 'users', - // ], + 'collaborators' => [ + 'driver' => 'eloquent', + 'model' => App\Collaborator::class, + ], ], /* @@ -93,9 +98,16 @@ return [ */ 'passwords' => [ - 'users' => [ - 'provider' => 'users', - 'table' => 'password_resets', + 'associates' => [ + 'provider' => 'associates', + 'table' => 'associate_password_resets', + 'expire' => 60, + 'throttle' => 60, + ], + + 'collaborators' => [ + 'provider' => 'collaborators', + 'table' => 'collaborator_password_resets', 'expire' => 60, 'throttle' => 60, ], @@ -125,10 +137,8 @@ return [ */ 'password_requirements' => [ - 'users' => [ - 'min_length' => 10, - 'max_length' => 255, - ], + 'min_length' => 10, + 'max_length' => 255, ], ]; diff --git a/database/migrations/2014_10_12_100000_create_password_resets_table.php b/database/migrations/2014_10_12_100000_create_associate_password_resets_table.php similarity index 71% rename from database/migrations/2014_10_12_100000_create_password_resets_table.php rename to database/migrations/2014_10_12_100000_create_associate_password_resets_table.php index 0ee0a36..9dcc92c 100644 --- a/database/migrations/2014_10_12_100000_create_password_resets_table.php +++ b/database/migrations/2014_10_12_100000_create_associate_password_resets_table.php @@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -class CreatePasswordResetsTable extends Migration +class CreateAssociatePasswordResetsTable extends Migration { /** * Run the migrations. @@ -13,7 +13,7 @@ class CreatePasswordResetsTable extends Migration */ public function up() { - Schema::create('password_resets', function (Blueprint $table) { + Schema::create('associate_password_resets', function (Blueprint $table) { $table->string('email')->index(); $table->string('token'); $table->timestamp('created_at')->nullable(); @@ -27,6 +27,6 @@ class CreatePasswordResetsTable extends Migration */ public function down() { - Schema::dropIfExists('password_resets'); + Schema::dropIfExists('associate_password_resets'); } } diff --git a/database/migrations/2014_10_12_100000_create_collaborator_password_resets_table.php b/database/migrations/2014_10_12_100000_create_collaborator_password_resets_table.php new file mode 100644 index 0000000..aa76ee1 --- /dev/null +++ b/database/migrations/2014_10_12_100000_create_collaborator_password_resets_table.php @@ -0,0 +1,32 @@ +string('email')->index(); + $table->string('token'); + $table->timestamp('created_at')->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('collaborator_password_resets'); + } +}