-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
preventLoginWithUnverifiedEmail not Working #2863
Comments
Hi, we have a unit test especially covering that case here: https://github.com/ParsePlatform/parse-server/blob/ad707457be13f177e4a0dc481c990ddbd2df8d80/spec/ValidationAndPasswordsReset.spec.js#L241 Can you please confirm that your configuration is correct and not any differences between the test and you actual setup? |
@calhouncole is there any way you can print the values of the following to the
I will upgrade my parse-server to 2.2.23 and I will try it again later during the day. |
i have same issue. i just want to block user that is not verified. and also i did not want to send them a verification code because i want that admin will verify them |
I wonder if the values being passed to Can you please hardcode the values of the following to true as a test to see if it works? If this works then I will submit a new PR to convert the value passed to these two options to a boolean.
|
I'm faced with the same problem. After some research I found that |
That's the whole point of, it anyone can signup, but you need your email to be verified to be able to login. In that case, probably the signUp should not issue a session token. |
signUp should not issue token, it also should return the same error as logIn (but User should be created) |
If this yields an error, user should not be created |
So, if server not able to create session (for any reason - db connection error or s.th. else) user which already created must be deleted? Or server should not raise error because user is exists in db? I don't understand why login should raise error, but signup not. |
what we should do is simply not return the session token upon signup if the server is configured to require a verified email. |
@fduch2k do you want to take on the implementation as discussed? |
Yes, I can implement this. But I can handle this task only on next week |
There's no rush, open a Pr when you're good :) |
has not been fixed yet? |
Not yet, it seems to have fallen into the cracks. Would you be willing to attempt a fix? I can guide you through it if you need to. |
Yes I need this feature, so the fix is:
right? |
Yes, that would be the way to go. Actually, the sessions should not be created at all. |
Auth.js -> getAuthForSessionToken Is here where I need to check the variable "preventLoginWithUnverifiedEmail"? |
The method you’re pointing out is checking the session token passed by the clients for their validity as well as the associated roles. We need to prevent the creation of Session objects when a user signs up or a user object is saved with an email that is not verified |
@flovilmart can you point me towards the code when a Session object is being created during Signup. Also, there is another unexpected behavior. When the verifyUserEmails option is enabled for the parse-server and if a Sign up attempt is made using only the username and password, which is mandatory, without passing an email. Then it doesn't let the User login saying the email is not verified. I think it shouldn't allow a User to Sign up, in the first place, without providing an email when the above option is enabled on the parse-server. |
@mryalamanchi There is a single spot in the code where the sessions are created https://github.com/parse-community/parse-server/blob/8604f9c/src/Auth.js#L350 and written. I should properly rename the So you could have a look at the different callers of
This is reasonable to expect this. |
@flovilmart I didn't see any session object being created in the DB ( So here's a rundown :
I would recommed you to not to rename it to To my understanding there doesn't seem to be any issue of session creation during sign up.
I understand. But I think this small feature can be improved upon from the server side itself without requiring any client-side workarounds. I am opening an issue along with it I will also provide a solution that I came up with. |
This stores in the _Session object wether it was created with a 3rd party auth (logIn) or a traditional email/password (signup) call. There’s no other purposes. It does not ‘create’ a session directly.
So I am not sure why we’re commenting on this 2 year old issue. I believe you mentioned you wanted to fix the issue, which means you have it in the first place no? As for the other part, you can implement it though a beforeSave(Parse.User) and enforce an email is set. |
@flovilmart gotcha! Thanks a lot for clarifying.
I recently started using Parse-Server and found it to be really useful given the fact that it's a full blown open source BaaS solution. So, I am wishing to contribute to this project. I am trying to de-clutter the issues section which brought me to this one.
I have gone through the API documentation and it suggested to use the same. An effective one indeed.
|
feel free to open a PR with the effective tests. I would ask you to add an additional startup option like |
@flovilmart will do so. That will be a neat approach. |
I looks worth revisiting. This is classified as feature request but from the description it looks like a bug. |
🎉 This change has been released in version 6.1.0-alpha.17 |
🎉 This change has been released in version 6.3.0-beta.1 |
🎉 This change has been released in version 6.3.0-alpha.1 |
🎉 This change has been released in version 6.3.0 |
Issue Description
I am running parse-server v. 2.2.22. In my ParseServer configuration, I have preventLoginWithUnverifiedEmail = true. On signup, before a user verifies their email, it still logs them in.
My configuration:
Steps to reproduce
Please include a detailed list of steps that reproduce the issue. Include curl commands when applicable.
Expected Results
The User will be blocked from login during signup.
Actual Outcome
The User is logged no problem.
Environment Setup
Logs/Trace
2016-10-13T03:55:00.897370+00:00 app[web.1]: GET /parse/login 200 103.378 ms - 341
The text was updated successfully, but these errors were encountered: