Jump to content

Recommended Posts

Posted

Hey Guys,

So i want to create a autologin option in my login-form by saving username and pass in a file by javascript. My Question: is where can i save Data that stays after the User left the Server? i know i can use the Node.js Filesystem Module but before i try i ask the community.
my Form:

form.PNG

Thanks!

Hank

Posted (edited)

If I ever go for such a system I wouldn't store names and passwords in files but match player IP and log them in if autologin option is enabled for the selected account. For players with dynamic IPs that would be a problem though.

The other solution is to generate a unique auth token and save it on the client. The token would link to player's account in the database and fetch the required data.

Client storage functions: https://wiki.rage.mp/index.php?title=Client-side_functions#Storage

 

Edited by Doom
  • Like 2
Posted
On 6/10/2019 at 4:29 PM, Doom said:

If I ever go for such a system I wouldn't store names and passwords in files but match player IP and log them in if autologin option is enabled for the selected account. For players with dynamic IPs that would be a problem though.

The other solution is to generate a unique auth token and save it on the client. The token would link to player's account in the database and fetch the required data.

Client storage functions: https://wiki.rage.mp/index.php?title=Client-side_functions#Storage

 

I couldn't say it better.

 

The user is already bad at keeping his password secret and not using the same password he'll use on your server on more services (probably including mail and so on). Don't make it more bad for him by saving his password plain text on a file.

  • Like 1
Posted
vor 20 Minuten schrieb robearded:

I couldn't say it better.

 

The user is already bad at keeping his password secret and not using the same password he'll use on your server on more services (probably including mail and so on). Don't make it more bad for him by saving his password plain text on a file.

Okey can some one give me a Hint on Client storage functions: https://wiki.rage.mp/index.php?title=Client-side_functions#Storage and some code? I am clueless and i think others would benefit from a example. i changed my login process by encrypting passwords using:

bcrypt.hash(pass, null, null, function(err, hash) {

and

bcrypt.compare(pass, sqlPassword, function(err, res2) {

at login. 

Thanks for the Response on this Thread!

Hank

  • Like 1
Posted
7 hours ago, HankSteiner said:

Okey can some one give me a Hint on Client storage functions: https://wiki.rage.mp/index.php?title=Client-side_functions#Storage and some code? I am clueless and i think others would benefit from a example. i changed my login process by encrypting passwords using:

bcrypt.hash(pass, null, null, function(err, hash) {

and

bcrypt.compare(pass, sqlPassword, function(err, res2) {

at login. 

Thanks for the Response on this Thread!

Hank

https://wiki.rage.mp/index.php?title=Storage.flush()

You can find an example there, so basically you use "mp.storage.data.whateverYouWant = ..." to store the data and "mp.storage.flush()" to save the data from the RAM(temporary storage) to the actual disk (permanent storage), will be run automatically on disconnect, however it is recommended to call it yourself too either after adding some data to be saved either at a regular time because if the player game crashes I don't think it will be time for the automatically flush to run.

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...