Share your repls and programming experiences

← Back to all posts
Sign in Website! You have an account even if you aren't old enough!
Codeverse (159)

Hello There! I wanted to make a sign in page, but without the difficulty of integrating Repl.it or Google sign in. You have to just make a username and password, and come back and log into the program again. If you want, I will let anyone who wants to implement this into their game do it. And if you can improve the code, or have suggestions, please comment below. I am sure I have stuff to change.

Super confuzzling part:

socket.on('login', data => {
    database.find({username: data.username}, (err, docs) => {
      if (docs.length > 0) {
        database.find({password: data.password}, (err, docs) => {
          if (err) {
            console.log('Error');
            return;
          }

          if (docs.length == 1) {
            socket.emit('login', {
              info: "Login successful",
              success: true,
              name: data.username
            });
          } else {
            socket.emit('login', {
              info: "Login not successful",
              success: false,
              name: 'Unknown'
            });
          }
        });
      }
    });
  });

Thank you! Hope you like it. I have spent 5 long hours debugging and coding it. The errors, they will haunt my dreams now. LOL xD

Comments
hotnewtop
RoyalCoder1234 (35)

coool website bro! Can I fork it tho?