If you have a contract that can accept that information, then this seems possible. I'm just getting comfortable with truffle console
myself, but it makes a couple of things easy (things that won't work quite the same in a d'app outside the console).
So, you create your UserInfo contract. You'll need the addPeople function, etc. I'm not going to write that part, but can follow up with an example if needed.
I use testrpc to make this easy to test. The first time I ran testrpc, I saved the mnemonic words it shows in the initial output (see the end of my post). I then saved those words to a text file (using copy/paste), and then restarted testrpc like this
testrpc --mnemonic "$(cat ./mnemonic.txt)"
This gives me the same initial, pre-created addresses each time, which is handy for consistent testing.
Then you do create the directory, do truffle init
, write the contract, do truffle compile
, make sure the new contract is in the migrations/2_* file, do truffle deploy
(or truffle deploy --reset
if you are making an update to the contract). SAVE the contract address here. You'll need it.
Now we are up to truffle console
and once you are there, your UserInfo contract is already pre-built (apparently truffle is being nice by having these ready for you in console). Here's the steps you need to run it:
let contractAddress = '<paste saved contract address>'
let abi = UserInfo.abi
let userInfo = web3.eth.contract(abi).at(contractAddress)
Now you can operate on userInfo
userInfo.getEmail() // say this getter method exists in your contract
userInfo.addPeople('Name', 'name@email.com', 'password123', {from: web3.eth.accounts[0]}); // I am new enough I haven't understood a geth-like 'default account' in truffle console
That last 'from' json object is to supply some gas for the transaction, since that one surely alters the state of the contract (adding a person to a mapping, probably).
That's all from the top of my head as I wait on a meeting. It's just the steps, and I was working this stuff out last night so it should be accurate. Let me know if you have problems and I'll see if I can help, too.
(Here's what the last few lines of testrpc look like if you run without --mnemonic)
HD Wallet
==================
Mnemonic: **analyst hello accuse shoulder able noise surface inform milk walnut remind yard**
Base HD Path: m/44'/60'/0'/0/{account_index}
Listening on localhost:8545
Copy the bolded list of works starting at analyst and ending at yard.