Make sure your firewall is not blocking the "TerrariaServer.exe" or the server's port ("7777" by default). Make sure the others join with the correct port number (especially important if it's not the default "7777"). If you are using a router you have to make sure it opens the server's port for you.
If you want to play Terraria online with other users, you have two options. You can use the Host & Play feature in the Terraria client to host your own online game on your device. Other players can then join the world either with or without a password.