New users to only login from same subnet

rgh
Member
 
Posts: 22
Joined: Fri Oct 07, 2016 13:32

New users to only login from same subnet

by rgh » Thu Mar 09, 2017 08:15

Is it possible to tell the server that new users can only login if doing so from the same subnet? Once a user has logged in the first time, they would be allowed to connect from any ip address?

If this isn't possible, are there any mods that do similar things, involving account creation and ip addresses that I could look at, with a view to adapting?
 

User avatar
octacian
Member
 
Posts: 408
Joined: Mon Dec 21, 2015 22:18
GitHub: octacian
IRC: octacian
In-game: octacian

Re: New users to only login from same subnet

by octacian » Thu Mar 09, 2017 15:20

Yes, it's possible through a mod. Essentially, you want to use minetest.register_on_prejoinplayer which if you return false, "<msg>" will prevent the player from logging in. I forgot the function, but it's also easily possible to get the player's IP address. If your server had a static IP, this could probably then be compared. At that point, if it comes from a non-local IP and is a new player, you can return false and a message. Otherwise, if it's a local IP or a past player, return true.

I'm not sure as to what the functions are to do this, and you may even have to use minetest.register_on_newplayer. Take a look at the Lua API and search around.
God isn't dead!

My Coolest Mods:
MicroExpansion, Working Computers, Interchangeable Hands

Check out my YouTube channel! (octacian)
 

rgh
Member
 
Posts: 22
Joined: Fri Oct 07, 2016 13:32

Re: New users to only login from same subnet

by rgh » Fri Mar 10, 2017 11:29

Thanks. I'll follow those suggestions up & see if I can get something working.
 


Return to Minetest General

Who is online

Users browsing this forum: No registered users and 83 guests

cron