i am doing a cfdump of session, i want to put ** w...
# cfml-beginners
s
i am doing a cfdump of session, i want to put ** where the word in the struct key is either "pass" or password
a
use
structMap(session, () => /* your code to obfuscate the value here */)
s
this may be just a safety catch for accidentally putting passwords in the session. but as a general rule passwords should not be stored in the session
3
a
Very good point.
s
like this <cfloop collection="#session#" item="i"> <cfoutput> #i# : #session[i]#<br> </cfoutput> </cfloop>
but i like the way you were saying structmap, can you show an example
then why this does not work
<cfloop collection="#session#" item="i"> <cfoutput> #i# : #session[i]#<br> <cfif i.lastvisit neq ''> <cfset i.lastvisit = '******'> </cfif> </cfoutput> </cfloop>
s
Copy code
<cfif session.lastvisit neq ''>
        <cfset session.lastvisit = '******'>
    </cfif>
<cfloop collection="#session#" item="i">
   <cfoutput>
      #i# : #session[i]#<br>
    </cfoutput>
</cfloop>
s
how did you get tinyTest in there?
a
See the
setupCodeGistId
in the URL?
s
yes…
a
So that gist is... TinyTest
s
well that is freaking awesome!!!
did abram add that for you?
no it'll load any gist
s
fancy, i did not know the
setupCodeGistId
param existed
a
It's really handy 🙂
(sorry for thread hijack, @Simone)
s
@Scott Steinbeck @Adam Cameron i did as mentioned in the chnage mentioned by Scot, it works, but setting it breaking my original code because it looks to fin or * now as i am setting that in the sessin scope, i am still consideing an option is there a way to keep it working but use the masked value to display that dump information but for original application, it should continue to work as is and in dumps it shows the data as *, considering of something like duplicate but not sure how/
a
How can you not be sure how to call a function?
Also if you use
structMap
, then it intrinsically doesn't touch your original struct, it returns a new one.