How To Put A Password On Your Mac Servers

Hi! Here is a guide I made on how to put a password on your mac servers! (In JavaScript)

Why not whitelists?

Here are some benefits of using this over whitelists:

  • If someone has multiple accounts (like one admin account, and one playing account), they can join!
  • If you have a friend that does not play, if they download the game they can join your server (with the password)!
  • I will add more to this eventually
Setting up the password

First, put this code in your welcome message:
(Make sure the code is enclosed in HTML script tags!)

var password = ‘prompt’
while (password != ‘YourPassWordHere’) {
password = window.prompt(“Password?”)
}

Replace ‘YourPassWordHere’ with your password.

I forgot my password

How to recover your password:

  1. Go on your WingySam Mac Server Portal
  2. Navigate to the world where you forgot your password
  3. Look at the welcome message.
  4. Log back into your world!
Done with your password?

Here is how to keep your code, but make it inactive.
First, you have to ‘comment out’ your code. Like this:

/*
var password = ‘prompt’
while (password != ‘test’) {
password = window.prompt(“Password?”)
}
*/

Notice how we put /* on the first line and */ on the last line. That is how you make a multi-line comment in JavaScript.

Well, you’re done! You learned how to set up and de-activate your password. Congratulations!

Note: While this will stop most people, note that it IS hackable!

You could somehow break into the owner portal? I don’t know.

Anything client side is hackable, and this is client side. It would stop me for maybe a minute at most.


You can achieve the same effect by whitelisting the player IP instead of their name, then they will be able to join with any name, though nobody seems to use this…

1 Like

Edited.

/set-password <password>

Server side, not hackable :slight_smile:

4 Likes

You can do that in mac servers?

I tested it and it told me that it set the password.