Simple User Registration Plugin

Discussion in 'Archived: Plugin Requests' started by Willbbz, Nov 6, 2013.

  1. Hey

    If anybody knows of a plugin that can achieve this, please let me know as that'd be super convenient rather than having to familiarise myself with java and bukkit again.

    Basically the plugin I need is going to be pretty simple

    The user logs into my server
    Runs the command /register <password>

    The plugin takes the players Minecraft username and string for their password and stores it in a database. Preferably I'd like a function in there that will hash/salt their password as I don't believe a password should ever be stored anywhere other than in the users head.

    The reason I'd like this is because I'd like to move away from allowing players to register on my website where they can enter in their own username. This way I can deliver the users server stats in a profile like fashion when they login on my site without them having to input their Minecraft username somewhere for me to use. It also cuts out the possibility of spam accounts and will allow me to grab their minecraft avatar with minotar as I'd have their username with the correct case.

    Would anybody be able to provide me some bear bones source code that could achieve this?
    Or even let me know where I could start to get this done.

    I've only ever developed one plugin and that was around this time last year so I'm rustier than the titanic.
     
  2. Offline

    timtower Administrator Administrator Moderator

    Willbbz spamming accounts is only possible when you run an offline server, we don't support that
     
  3. I think you misunderstand. I was speaking about users signing up to my website with any username means they can sign up for an infinite amount of accounts.

    If this plugin can register them to the user database and it's the only way to register, it eliminates spam entirely so long as offline-mode is set to true.
     
  4. Offline

    timtower Administrator Administrator Moderator

    You can also just let your website check if they login with their mc accounts...
    Code:
    $return = file_get_contents('http://login.minecraft.net/?user='.$username.'&password='.$pass.'&version=13');
    if($return=="Account migrated, use e-mail as username."){
        $_SESSION['error']='Use email to login!';
        die;
    }else if($return=="Bad login"){
        $_SESSION['error']='No valid login';
        die;
    }else{
        //Do stuff when logged in here
    }
     
  5. That's not a bad idea! Thanks for pointing that out. I was originally just checking to see if the account existed with

    PHP:
    $exists file_get_contents('http://www.minecraft.net/haspaid.jsp?user=' $username);
    echo 
    $exists;
    if (
    $exists == "true")
                    {
                    
    $_SESSION['login']="1"//set the value of the 'login' session variable to 1
                    
    $_SESSION['username'] = $username;
                    
    header('Location: index.php');
                    }else
                    {
                    echo 
    ": That's not a valid Minecraft username :( - <a href='https://www.minecraftia.net'>try again?</a>";
                    }
    The only issue I'd have with using Mojangs auth server is that it is down at times.
     
  6. Offline

    timtower Administrator Administrator Moderator

    Well, you would have that issue anyways :p
     
  7. True that!

    Alas a plugin request was submitted :p
     
  8. The plugin does a bit too much as it requires the player to put in their login with their password when they join the server.

    Also this would not fly well with my users :p
    Albeit the plugin does support several types of hashing. I'll take a look at the source and try pull out the minimal plugin I'm looking for. Thanks :)
     
  9. Offline

    BillyGalbreath

    Willbbz Theres lots of plugins out there. xAuth, RoyalAuth, SkyAuth, ExtraAuth... etc. Most of them (obvisouly) end with "auth" in the name, so they are fairly easy to find.

    I've used xAuth and RoyalAuth, but personally prefer xAuth.
     
  10. Those plugins have a lot of functionality but they're for making sure the correct player is logged into the server and will ask the player to login or register after joining.

    Ignore that the reason I'm looking for a plugin is to help with registration/logging in on my website.
    Essentially the plugin I'm looking for is one that will put a string entered by the user into a row of a table in a database.
    There is probably no plugin that does just this alone but would anybody know what functions/methods I'd need to use to achieve this?
     
  11. Offline

    BillyGalbreath

    You can use most of the plugins I mentioned to do what you want. All you need is to sync them with your website's database, which I believe most have the ability to do so for popular database formats (like XenForo, etc). Then when your users register on the site, they are registered according to the plugin.

    Most of the plugins also have a ip-based "session" that you can lengthen to an infinite time. That way when they register/login they will create a session that will stick indefinitely on the server and they'll never have to login again. (They'll have to on the site like normal, but not minecraft). You would just need to add a small mod to the site to inject this session data when the user registers.

    Its not really that hard to do what you're asking with minimal effort with the tools already in existence. I've dont this for my server on many sites (XenForo, vBulletin, Wikipedia, WordPress, and even custom made sites).
     
  12. Offline

    freddytheslime

    You
    you have a nice profile pic
     
    Willbbz likes this.

Share This Page