-1

Can you display a Form::password as text instead of the dots/bullets that are default in Laravel?

I want this no dots instead of this dots

giannis christofakis
  • 8,201
  • 4
  • 54
  • 65
Valerie
  • 34
  • 2
  • 6

5 Answers5

5

No. Form::password creates an <input type="password"> HTML tag, which all modern browsers will render with its value masked for security reasons. You can't change that, you can only use text type input instead.

lafor
  • 12,472
  • 4
  • 32
  • 35
  • 1
    I agree with answer. If for some reason you want to show the password in plain text than just use a textbox element. There is really no difference except how the browser treats the display. It's kinda frowned upon to show the password when a user inputs it. It's possible that someone could be watching them. However, as the product owner it is YOUR decision to make. Some sites use a "show password" link which will show the password in plaintext for the user. This could be a good alternative. In this case you could just use javascript to mirror the password to a textbox and toggle visibility. – Carlos Cervantes Dec 28 '13 at 02:09
  • 2
    @Liquid90605 You could use JS to just change the `type` attribute of the password input to `text`, and vice versa. – Aken Roberts Dec 28 '13 at 05:02
2
<input type="password" id="password">
<input type="checkbox" onchange="document.getElementById('password').type = this.checked ? 'text' : 'password'"> Display password

post: "Show password as text" control

Community
  • 1
  • 1
SaK
  • 410
  • 3
  • 10
0

You shouldn't show the password to your users. The characters in a password field are masked.

Here is the field generation just to explain you :

<!--Generating A Text Input-->
Form::text('password')

<!--Generating A Password Input. The characters in a password field are masked-->
Form::password('password');

Good read : http://laravel.com/docs/html

<!-- Following textbox will show the password in text -->
Password: <input type="text" name="pwd">
<!-- Following textbox will show password as asterisks or circles. The characters in a password field are masked -->
Password: <input type="password" name="pwd">
RaviRokkam
  • 789
  • 9
  • 16
0

If you've told your users that this is a "password" of some sort, you should NEVER display it in clear text. They will expect it to be obscured by dots during entry. Why do they need to see the clear text? That is never done with passwords on any system.

What kind of "authentication" do you need, and why do you need to display the clear text in order to do it? The text you get back from the form should be "clear" to the program... it's just not visible to users.

Phil Perry
  • 2,126
  • 14
  • 18
  • I use it as a code. I work with a "login" for multiple users, I don't want user accounts, so I work with a unique code (something like bluetooth does). I think it's weird to just see dots when you just got 1 field (there's only that code-field, no username or something like that) – Valerie Dec 27 '13 at 16:30
  • Well, it all comes down to: "is this a _security_ code of some sort, that you would not want to get out into the general public?" If not, it's not a password or passcode or PIN type thing, and should not be called as such. If you _do_ want to keep it out of the general public (i.e., would not want to see it posted on a warez board), treat it as a confidential password. – Phil Perry Dec 27 '13 at 17:14
0

Ofcourse you can do that! As Ravi Rokkam says: Just create an input-element with type=text instead of type=password with Form::text('password').

You can do it with plain HTML right in the template or extend Laravels form builder class.

With the help of JavaScript it's also possible to create an input-elemnt that displays its value (maybe a placeholder like "password"?) but if the users focuses it it displays bullets. (Create an input-element with type=text and when the focus-event triggers, change the type to password)

chris342423
  • 439
  • 1
  • 6
  • 22