Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Your Account is Banned message when creating accounts via seeding #48

Closed
kobescoresagain opened this issue Jul 31, 2015 · 10 comments
Closed

Comments

@kobescoresagain
Copy link

I am getting this message automatically when I create accounts via seeding, I looked around in the database and I don't see a 'status' field that is set to 2. How can I either fix the problem in the seeding itself or easily unban these accounts without going through the password reset steps.

@rappasoft
Copy link
Owner

Are you specifically setting the status column in the seed to 2?

@kobescoresagain
Copy link
Author

No, actually I don't set the status column at all. Thanks in advance for the help. Do I need to go ahead and set status? Here is what I am doing in the seeder:

'test', 'username' => 'Admin', 'email' => 'test@mailinator.com', 'password' => bcrypt('fakepass'), 'confirmation_code' => md5(uniqid(mt_rand(), true)), 'confirmed' => true, 'created_at' => Carbon::now(), 'updated_at' => Carbon::now() ], [ 'name' => 'Default User', 'username' => 'Tester', 'email' => 'test2@mailinator.com', 'password' => bcrypt('fakepass2'), 'confirmation_code' => md5(uniqid(mt_rand(), true)), 'confirmed' => true, 'created_at' => Carbon::now(), 'updated_at' => Carbon::now() ], ]; DB::table(config('auth.table'))->insert($users); } ``` }

@rappasoft
Copy link
Owner

The 4th migration setup_access_tables, installs the status column, did you run all of the migrations?

@kobescoresagain
Copy link
Author

I do indeed have that in my migrations. I did have to modify things as I am using postgres. Here is what I have in that file:

boolean('status')->after('password')->default(true); }); Schema::create(config('access.roles_table'), function ($table) { $table->increments('id')->unsigned(); $table->string('name')->unique(); $table->timestamps(); }); Schema::create(config('access.assigned_roles_table'), function ($table) { $table->increments('id')->unsigned(); $table->integer('user_id')->unsigned(); $table->integer('role_id')->unsigned(); $table->foreign('user_id') ->references('id') ->on(config('auth.table')) ->onUpdate('cascade') ->onDelete('cascade'); $table->foreign('role_id')->references('id')->on(config('access.roles_table')); }); Schema::create(config('access.permissions_table'), function ($table) { $table->increments('id')->unsigned(); $table->string('name')->unique(); $table->string('display_name'); $table->boolean('system')->default(false); $table->timestamps(); }); Schema::create(config('access.permission_role_table'), function ($table) { $table->increments('id')->unsigned(); $table->integer('permission_id')->unsigned(); $table->integer('role_id')->unsigned(); $table->foreign('permission_id') ->references('id') ->on(config('access.permissions_table')); $table->foreign('role_id') ->references('id') ->on(config('access.roles_table')); }); Schema::create(config('access.permission_user_table'), function ($table) { $table->increments('id')->unsigned(); $table->integer('permission_id')->unsigned(); $table->integer('user_id')->unsigned(); $table->foreign('permission_id') ->references('id') ->on(config('access.permissions_table')); $table->foreign('user_id') ->references('id') ->on(config('auth.table')); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table(config('auth.table'), function(Blueprint $table) { $table->dropColumn('status'); }); Schema::table(config('access.assigned_roles_table'), function (Blueprint $table) { $table->dropForeign(config('access.assigned_roles_table').'_user_id_foreign'); $table->dropForeign(config('access.assigned_roles_table').'_role_id_foreign'); }); Schema::table(config('access.permission_role_table'), function (Blueprint $table) { $table->dropForeign(config('access.permission_role_table').'_permission_id_foreign'); $table->dropForeign(config('access.permission_role_table').'_role_id_foreign'); }); Schema::table(config('access.permission_user_table'), function (Blueprint $table) { $table->dropForeign(config('access.permission_user_table').'_permission_id_foreign'); $table->dropForeign(config('access.permission_user_table').'_user_id_foreign'); }); Schema::drop(config('access.assigned_roles_table')); Schema::drop(config('access.permission_role_table')); Schema::drop(config('access.permission_user_table')); Schema::drop(config('access.roles_table')); Schema::drop(config('access.permissions_table')); } ``` }

@kobescoresagain
Copy link
Author

I did find status in the tables, it is set to TRUE for both users.

@rappasoft
Copy link
Owner

There should be no reason that message is being thrown while seeding.

@azulkipli
Copy link

I got this issue too when using PostgreSQL, related to
#51

I do comment these statement, because on postgresql these not supported

DB::statement('SET FOREIGN_KEY_CHECKS=0;');
...
DB::statement('SET FOREIGN_KEY_CHECKS=1;');

and

DB:table('table')->truncate( ) in each seed classes

I try this
http://espadav8.co.uk/2015/03/04/laravel-database-seeding-with-postgresql/
but still not solve banned issue

@azulkipli
Copy link

to solved this banned issue on PostgreSQL I change status type to integer instead of boolean

@kobescoresagain
Copy link
Author

Thanks Azulkipli, I made that change it and worked.

@rappasoft
Copy link
Owner

I have fixed all of this with this commit: 57a3603

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants