Closed meghabytes closed 6 months ago
Refer to the smart contract (.sol file). Some usernames and passwords have been hardcoded there.
On Mon, Apr 15, 2024, 4:09 PM Meghana @.***> wrote:
In localhost:3000 when we first start the react app, is it asking for an address and password. WHich address and password should this be? I am using ganache for deploying the contract and had set 2 addresses from ganache in health.sol Thank you
— Reply to this email directly, view it on GitHub https://github.com/GovardhanR26/distributed-healthcare-system/issues/2, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASIPK36FI6V77DSJC7AHGWTY5OU5ZAVCNFSM6AAAAABGHCVTRSVHI2DSMVQWIX3LMV43ASLTON2WKOZSGI2DGMZSGA4TANQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Correction. Passwords have NOT been hardcoded anywhere. You need to invoke the add_doctor method (refer Health.sol for the required params; use 'address' from your Ganache) via your terminal after deploying the smart contracts, then restart the React app. Use this username and pwd to login in the React application.
even I facing the same problem. I have executed HealthContract.deployed().then(function(instance) { return instance.add_doctor("addr", "Dr John", "City Hospital","Cardiology",40 ,"password123"); console.log("Doctor added successfully.");}).catch(function(err) { console.error("Error adding doctor:",err); }); in the truffle console then launched the react application. Still i am getting the same error address not found........what exact console have u used sir for adding the doctor?
Thank you sir, the doctor login part is resolved for me. But now, the doctor can add patients ( no address is required to add the patient), and again, the patient also has to be added manually in the truffle command prompt right? Because otherwise we won't be able to login as patient as we don't know to what address the patient got added?
Please correct me if I am missing something. Thank you.
@lasya-talasila @meghabytes Refer to line 53 of the Health.sol file. Two private keys and addresses have been hardcoded there (addresses and keys taken from Ganache). These address and keys are for patients only i.e they are to be allocated to any patient that are registered by any doctor (through the React app).
Doctor registration is not done via the app, but done by the admin through the terminal/console (not sure what it is called - Truffle console, I guess; Long time since I worked on this project) using the add_doctor
method defined in the Health.sol file. An address is required for doctor registration too, and for this, you can give an address from Ganache which is NOT present in the hardcoded ones (to be used for patients).
@lasya-talasila @meghabytes Steps to follow:
function add_doctor( address _addr, string memory _name, string memory _hospital, string memory _special, uint _age, string memory _password )
Okay sir, thank you so much for your time and replies.
Thank you sir, the doctor login part is resolved for me. But now, the doctor can add patients ( no address is required to add the patient), and again, the patient also has to be added manually in the truffle command prompt right? Because otherwise we won't be able to login as patient as we don't know to what address the patient got added?
Please correct me if I am missing something. Thank you.
Good question. The address for the patient, who has been registered by a doctor, is generated (selected from the predefined set) and is revealed to the patient via email. An auto-generated password is also sent. The patient logs in using these credentials.
Doctor registers the patient through the app; no need to do it via the terminal.
@meghabytes You might need to look at the email service code used, and set it up using your personal credentials.
import emailjs from "@emailjs/browser";
Hope this helps.
Thank you sir, the doctor login part is resolved for me. But now, the doctor can add patients ( no address is required to add the patient), and again, the patient also has to be added manually in the truffle command prompt right? Because otherwise we won't be able to login as patient as we don't know to what address the patient got added? Please correct me if I am missing something. Thank you.
Good question. The address for the patient, who has been registered by a doctor, is generated (selected from the predefined set) and is revealed to the patient via email. An auto-generated password is also sent. The patient logs in using these credentials.
Doctor registers the patient through the app; no need to do it via the terminal.
@meghabytes You might need to look at the email service code used, and set it up using your personal credentials.
import emailjs from "@emailjs/browser";
Hope this helps.
Thanks a lot for all the help sir. I was able to figure it out.
In localhost:3000 when we first start the react app, is it asking for an address and password. WHich address and password should this be? I am using ganache for deploying the contract and had set 2 addresses from ganache in health.sol Thank you