forms - How to keep the value in a field from the inputPassword helper in the Play framework? -


excuse me if answer obvious whilst know java new scala, play framework , general web app development.

i have taken on project has view can set database connection details includes fields such database name, username, password etc. @ present code uses play input helper 'inputtext' , password field shows password in plain text. need fix , have changed use 'inputpassword' helper whenever visit page in app edit 1 of other fields password field has not been populated password user needs re-enter in order save, not want have this.

the password populated when inputtext helper can assume there's in inputpassword helper stops value populating in form, maybe expects password field used when inputting new one? there way override , have fill in on screen form password user not have re-enter in order change field on page?

this old version in view

@inputfield(form("password"), '_label -> "password", '_labelwidth -> "2", 'class -> "form-control", '_type -> "password", '_single -> false)</code> 

this new version

@inputpassword(form("password"), '_label -> "password", '_labelwidth -> "2", 'class -> "form-control", '_single -> false, '_type -> "password") 

i have templates inputfield.scala.html contains @helper.inputtext(field, args:_*) , inputpassword.scala.html contains @helper.inputpassword(field, args:_*)

i tried adding 'value -> form("password").value parameters in inputpassword version , whilst displayed in stars in password field credentials incorrect cannot have been correct information.

any or suggestions appreciated, if understand why inputtext populates field whereas inputpassword not. other way can think of possibly have password separate form on same page , make password entry mandatory when using page initial set of database credentials , optional on edit page.

i don't think it's necessary send password values , forth security reasons. internet user i've never seen form filled password.

regarding case see 2 options:

  • either separate password change form (but option if have more sophisticated password reset process, two-step verification)
  • or apply following password validation logic on server: leave password unchanged if empty

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -