Crud: Password field is ignored when creating

Created on 22 Sep 2016  路  3Comments  路  Source: Laravel-Backpack/CRUD

The storeCrud method ignores the password field.
$item = $this->crud->create($request->except(['redirect_after_save', 'password', '_token']));

This doesn't happen on the updateCrud method.
$this->crud->update($request->get($this->crud->model->getKeyName()), $request->except('redirect_after_save', '_token'));

On a basic user crud like this one:

[
    'name' =>'name',
],
[
    'name' =>'password',
    'type' => 'password',
],
[
    'name' =>'email',
    'type' => 'email'
],

You cannot create a password for a new user, but you can update the password of an existing user.

Bug

Most helpful comment

Hi @Alexgmin ,

It's now fixed, you can the 'password' input like any others. Of course, for passwords you should probably have a mutator in your model to bcrypt() it.

Cheers!

All 3 comments

Hmm... you're right...

@mariusconstantin2503 - do you remember what the purpose of that is?
@OwenMelbz - you've recently been there. Your 2 cents? you think removing that from CRUD will break anything other than PermissionManager?

Thanks!

@tabacitu I cant see a clear cut reason for it being there, unless it was to prevent accidental plain text passwords being saved? or incase there was something within the Register method for new users that sign up from the register webpage?

Hi @Alexgmin ,

It's now fixed, you can the 'password' input like any others. Of course, for passwords you should probably have a mutator in your model to bcrypt() it.

Cheers!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mklahorst picture mklahorst  路  3Comments

voidstate picture voidstate  路  3Comments

jorgepires picture jorgepires  路  3Comments

abewartech picture abewartech  路  3Comments

bahman2216 picture bahman2216  路  3Comments