html - How to insert password as Hash to Ms SQL in coldfusion? -
i creating form saves user registration. want insert password database hash or md5.
this html form few coldfusion codes:
<form id="myform" class="ui form segment" method="post" action="registeraction.cfm"> <p>let's go ahead , signed up.</p> <div class="field"> <div class="field"> <label>name</label> <input placeholder="name" name="name" type="text"> </div> </div> <div class="field"> <div class="field"> <label>email</label> <input placeholder="email" name="email" type="email"> </div> </div> <div class="field"> <div class="field"> <label>password</label> <input placeholder="password" name="password" type="password"> </div> </div> <input class="ui blue submit button" type="submit" value="submit"> </form>
this code in registeraction.cfm :
<!--- insert new record ---> <cfinsert datasource="mydatasource" tablename="users"> <h1>user added</h1> <cfoutput> have added #form.name# #form.email# testdb database. </cfoutput>
i think should work you. in registeraction.cfm create hash , store in form.password (i recommend using cfc business logic , use cfm presentation )
<cfset form.password = hash(form.password, "sha") > <!--- insert new record ---> <cfinsert datasource="mydatasource" tablename="users"> <h1>user added</h1> <cfoutput> have added #form.name# #form.email# testdb database. </cfoutput>
Comments
Post a Comment