Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

jeremy.jass's avatar

Clear Text 'Password' Field

As part of the system we are designing, we need to store passwords for offline hardware deployed in the field. Each piece of hardware has Model storing their attributes, and everything was going great until it came to storing the password. To log in to make changes to the hardware, you need to type the password into a local SSH terminal, which mean I need to be able to read back the password which is unique and randomly generated for every piece of hardware (I'm encrypting the field before storing it in the database myself, ideally moving that logic into mutators). The problem is when I add a field to the form:

{!! Form::label('password', 'Password:') !!}
{!! Form::text('password', null, ['class' => 'form-control']) !!}

Laravel sees that I have named my field 'password' so automatically 'fixes' my input type from text to password. If I wanted password formatting, I would have specified "Form::password( ... )", but it looks like Laravel is being a little too helpful here. Is there any way to override this automatic input type conversion, or do I need to rename my field? We are using form-model-binding, so renaming the field entails a database change, and a less intuitive field name, both of which are less than ideal.

Thanks!

0 likes
2 replies
ohffs's avatar

Just make the password field manually instead of using the Form:: bindings?

jeremy.jass's avatar
jeremy.jass
OP
Best Answer
Level 4

SOLVED:

Thanks for the idea ohffs. After manually coding a text field and still seeing the automatic conversion, I realized the problem was with my browser (Chrome) and not a Laravel issue. If you make a Form::text, Laravel makes a text field, just be careful because some browsers will automatically convert their type.

Please or to participate in this conversation.