Ask coding questions

← Back to all posts
How to add a login form

I want to make a login/register form for my chatroom, however I dont know how to do it? I want to make the form secure enough, so that if somebody goes into the repl, they wont see the passwords

SixBeeps (5219)

There are many solutions to this, but here's how I'd do it.

  • Make a database for all the different accounts. Doesn't matter how you do it, just make sure you can read and manipulate the contents through your server-side code.
  • Set up a web server. You can do this with something like PHP or ASP.NET, but since you need a hacker plan to host private repls, I'd recommend that you do this on one of your own servers. If you don't have an extra computer laying around, I'd look into Amazon AWS or Microsoft Azure.
    • In your server-side code, make a GET response method that will check the DB for the given credentials and return a token of some sort back to the user if the credentials are correct.
    • You should also make a SET response method for user creation if that's a feature you want.
  • Make the client (website) call a GET request to the server with the user's inputted credentials. Use the value that the server returns to do stuff (i.e. login to the chatroom.)
AdCharity (1322)

uhhh I think I saw this project somewhere before.... Especially that background image. Plus with scale drone, its probably better you don't make accounts anyway cause the entire purpose of scale drone is to make it easy. You could make a really simple looking login like on my project or use Google Spread sheets api but idk how to do that.


@AdCharity im re-making a chatroom ive made before

Vandesm14 (2728)

You need to learn Nodejs and Expressjs in order to get a server up and running. Then connect the server to a database of your choice and hookup all of the endpoints. I can't really point you to an example as most login systems are custom built, there really isn't a general purpose library.