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

packytagliaferro picture packytagliaferro  路  3Comments

gotrecillo picture gotrecillo  路  3Comments

AlexanderWM picture AlexanderWM  路  3Comments

sonoftheweb picture sonoftheweb  路  3Comments

bastos71 picture bastos71  路  3Comments