frankcollins3 / fill_container

codecamp team project updated with new icon screen menu + puppeteer icon search, GraphQL, redux, relational psql !mongo, and accuweatherAPI
1 stars 0 forks source link

how to hash characters while entering password input data [2:23pm] #76

Closed frankcollins3 closed 1 year ago

frankcollins3 commented 1 year ago

onmouseenter func: set ID of hovered-upon elem ("username", "pw", "email" etc). Set that string value from ID as input value

const ghosttext = (event:any) => {
        let target:any = event.target
        let jqtarget:any = $(event.target)
        let targetId:string = event.target.id        
        if (targetId === 'password') {
            console.log(`psst: ${event.target.value}`)        
        }
        // modular function arguments:                  1: target $(event.target)   2: 'value' <input value={}/>        3: targetId: ['username', 'password',]
        attributeJQ(target, 'value', targetId)         // $(event.target).attr('value', targetId)
    }

I'm curious as to how to use the onChange handler function instead of onMouseEnter function and to hash every character so that the user can't see what they're typing as they enter their password.

frankcollins3 commented 1 year ago
    const passwordinputhandler = (event:any) => {
        let value:string = event.target.value
        let hashedValue = "*".repeat(value.length)
        $(event.target).attr('value', hashedValue)
        SET_PASSWORD({payload: hashedValue})
    }

the blue password input data is showing but the state is changing to be hashed values. Screen Shot 2023-06-01 at 2 59 29 PM

[3:00pm]

frankcollins3 commented 1 year ago

👍

const passwordinputhandler = (event:any) => { let value:string = event.target.value let hashedValue = "*".repeat(value.length) $(event.target).attr('value', hashedValue) SET_PASSWORD({payload: hashedValue}) }

thought I set the state already with this code the jquery setting of value doesn't persist

[3:03pm]