Closed bourgeoa closed 8 months ago
Also replacing throw error with success
with
if (userAccount && !userAccount.email) { return resetLinkMessage ()
fix branch created
fix/issue#1774
The only ways to get the resetLinkMessage() call into the AccountManager class is to either make it static from the PasswordResetEmailRequest class, copy it into the AccountManager class, or to pass the instance of PasswordResetEmailRequest class into the AccountManager class. I currently have where if it throws the Error in verifyEmailDependencies with specific message, do renderSuccess() in PasswordResetEmailRequest.loadUser if !exists
Thank you for looking at this
if (userAccount && !userAccount.email) { return resetLinkMessage ()
This was an error You should keep the throw Error, with the check on userAccount the function will not return an Error when the username do not exist So we should have
if (userAccount && !userAccount.email) {
throw new Error('Account recovery email has not been provided')
}
And you will have simply something like
if(!exist) {
this.accountManager.verifyEmailDependencies() // without userAccount, this will only throw Error on `email service not setup`
return this.resetLinkMessage() // this is the expected email sent message
}
Well there is alsoa logic issue with the 2 PRs
you will have a conflict with the last merged one.
So you have the choice to keep only one PR for both issues.
Or a bit more complex
I took the changes I made from 1770 and integrated them with this fix/issue#1774 request, so fix/issue#1770 pull request can be closed without merge as all changes are incorporated into the PR which fixes 1774, as it fixes both 1770 and 1774.
This is a follow on issue#1771 We need to have allways same response when user exists/notExists
Email service is not set up
also when username do not existAccount recovery email has not been provided
these are/should be rare cases when email is setup and only on really experimental server. When username do not exist I propose to return the actual no errorAdding (in username
if (!exists)
) a call to verifyEmailDependencies () https://github.com/nodeSolidServer/node-solid-server/blob/88d3a8625a590f9dfc20dc00562b886caeb03817/lib/models/account-manager.js#L535-L543Also replacing throw error with success https://github.com/nodeSolidServer/node-solid-server/blob/88d3a8625a590f9dfc20dc00562b886caeb03817/lib/models/account-manager.js#L540-L542
with
fix branch created
fix/issue#1774