standardnotes / self-hosted

[Legacy] Self-host your own Standard Notes server for end-to-end encrypted notes and files
https://github.com/standardnotes/server
GNU Affero General Public License v3.0
343 stars 39 forks source link

[BUG] Cannot register on fresh installation #72

Open reanim8ed opened 2 years ago

reanim8ed commented 2 years ago

After fresh server setup I tried to register new user in the app.standardnotes.org platform with my custom server address in the advanced options form. Immedietly after POST request, I get expired login screen but loging in with same credentials doesnt work. In server logs I can see failed attempts logged. But if I check the users table in mysql container - it's still empty.

I tried to use these new credentials on default sync server - and I'm logged in. It seems that registration form doesnt care about custom server address account is not registered on the custom server but in api.standardnotes.com server instead.

Case in point: I can provide any link in custom server address, like: https://anything.google.com and system still return error: This email is already registered if I try to use the same email which was used to register in your standart server.

stevensiebe commented 2 years ago

A similar error for me, using a fresh install on a fresh server A server error occurred while trying to register. Please try again. Trying again shows An existing registration request is already in progress.

If I reload the page and attempt to sign in, I'm prompted to enter a two-factor authentication code, which I can't because I haven't signed in to set up 2fa.

Nicicalu commented 2 years ago

Same here!

dasTor commented 2 years ago

Same, any eta on a fix?

moughxyz commented 2 years ago

Ensure you're up to date on both the client and backend. There's been a few changes in this area so if you're running older versions with newer clients you'll have this issue.

https://docs.standardnotes.com/self-hosting/updating

dasTor commented 2 years ago

i have updated my backend yesterday, client was freshly downloaded yesterday too. i can see in the error_console of the client (mac os) that even though custom sync server is set, the registration request is sent to standardnotes.com

moughxyz commented 2 years ago

Ah, indeed. Looks like a recent regression caused by a refactor of our registration handler. Will be fixed by https://github.com/standardnotes/snjs/pull/771.

Nicicalu commented 2 years ago

Ah, indeed. Looks like a recent regression caused by a refactor of our registration handler. Will be fixed by standardnotes/snjs#771.

🙂 thanks!

Nicicalu commented 2 years ago

Thanks! It started working, after I ran:

./server.sh update
moughxyz commented 2 years ago

Note that registrations made during the time the regression was live (I believe it was only the web app, for only a couple days) were made to our server, and those accounts will still exist in our server until deleted. Wit the fix now deployed, you'll have to re-register on your server.

carlox97 commented 2 years ago

@moughxyz I'm having the same problem: I self-hosted the docker standalone server and upon the first login after registering I get asked a 2FA code which prevents me from logging in.

Nicicalu commented 2 years ago

@moughxyz I'm having the same problem: I self-hosted the docker standalone server and upon the first login after registering I get asked a 2FA code which prevents me from logging in.

Did you run ./server.sh update on your server?

carlox97 commented 2 years ago

@moughxyz I'm having the same problem: I self-hosted the docker standalone server and upon the first login after registering I get asked a 2FA code which prevents me from logging in.

Did you run ./server.sh update on your server?

Yes, I did. I'm trying to host a local istance (no https) before going public.

This is what I did/steps to reproduce, I didn't edit anything besides commands shown.

git clone --single-branch --branch main https://github.com/standardnotes/standalone.git
cd standalone
./server.sh setup

sed -i "s/auth_jwt_secret/$(openssl rand -hex 32)/g" .env
sed -i "s/secret/$(openssl rand -hex 32)/g" docker/auth.env
sed -i "s/legacy_jwt_secret/$(openssl rand -hex 32)/g" docker/auth.env
sed -i "s/secret_key/$(openssl rand -hex 32)/g" docker/auth.env
sed -i "s/server_key/$(openssl rand -hex 32)/g" docker/auth.env

./server.sh update

Status looks good, everything running, healtcheck OK.

I tried to register from iOS, Android, Windows using "http://10.0.0.100:3000", I got a generic error at times, upon clicking register, regardless of this error I cannot register with another account because "another registration in progress" (or something in those lines). Upon trying to log in from the app (any platform) I get prompted to input the 2FA code, which I don't have, obviously, and at the same time the logs show:

auth-standalone                      | query: SELECT `user`.`uuid` AS `user_uuid`, `user`.`version` AS `user_version`, `user`.`email` AS `user_email`, `user`.`pw_nonce` AS `user_pw_nonce`, `user`.`encrypted_server_key` AS `user_encrypted_server_key`, `user`.`server_encryption_version` AS `user_server_encryption_version`, `user`.`kp_created` AS `user_kp_created`, `user`.`kp_origination` AS `user_kp_origination`, `user`.`pw_cost` AS `user_pw_cost`, `user`.`pw_key_size` AS `user_pw_key_size`, `user`.`pw_salt` AS `user_pw_salt`, `user`.`pw_alg` AS `user_pw_alg`, `user`.`pw_func` AS `user_pw_func`, `user`.`encrypted_password` AS `user_encrypted_password`, `user`.`created_at` AS `user_created_at`, `user`.`updated_at` AS `user_updated_at`, `user`.`locked_until` AS `user_locked_until`, `user`.`num_failed_attempts` AS `user_num_failed_attempts` FROM `users` `user` WHERE `user`.`email` = ? -- PARAMETERS: ["************@protonmail.com"]
cache-standalone                     | 1:M 15 Jul 2022 20:18:19.492 * Background saving terminated with success
syncing-server-js-worker-standalone  | {"message":"Alive and kicking!","level":"info"}
auth-worker-standalone               | {"message":"Alive and kicking!","level":"info"}
pageb018 commented 1 year ago

I am still getting the enter 2-fa prompt when trying to create a new account on a brand new install.

Both backend and app are up to date.

carlox97 commented 1 year ago

I am still getting the enter 2-fa prompt when trying to create a new account on a brand new install.

Both backend and app are up to date.

Try to ./server.sh cleanup then delete all files and clone from repo again, following the basic setup instructions on their docs and run ./server.sh update. Then be sure there are no typos in email and pass when you register and try to create a password with a-z A-Z 1-9 and “!#”. I managed to login without the 2fa error in this way. Still no idea what I was doing wrong.

pageb018 commented 1 year ago

I am still getting the enter 2-fa prompt when trying to create a new account on a brand new install. Both backend and app are up to date.

Try to ./server.sh cleanup then delete all files and clone from repo again, following the basic setup instructions on their docs and run ./server.sh update. Then be sure there are no typos in email and pass when you register and try to create a password with a-z A-Z 1-9 and “!#”. I managed to login without the 2fa error in this way. Still no idea what I was doing wrong.

Thank you for this, however it did not work for me. I am getting a different error though. I tried the above and even tried a fresh install on a new machine from scratch.

I now receive an invalid user/pass error and see the following in the logs:

auth-standalone | query: SELECTuser.uuidASuser_uuid,user.versionASuser_version,user.emailASuser_email,user.pw_nonceASuser_pw_nonce,user.encrypted_server_keyASuser_encrypted_server_key,user.server_encryption_versionASuser_server_encryption_version,user.kp_createdASuser_kp_created,user.kp_originationASuser_kp_origination,user.pw_costASuser_pw_cost,user.pw_key_sizeASuser_pw_key_size,user.pw_saltASuser_pw_salt,user.pw_algASuser_pw_alg,user.pw_funcASuser_pw_func,user.encrypted_passwordASuser_encrypted_password,user.created_atASuser_created_at,user.updated_atASuser_updated_at,user.locked_untilASuser_locked_until,user.num_failed_attemptsASuser_num_failed_attemptsFROMusers`user WHERE user.email = ? -- PARAMETERS: ["brian@mydomain.org"]`

pageb018 commented 1 year ago

nvm, I am an idiot.

I needed to register the account first.