identityChange doesn't verify the user's password
Closed this issue · 17 comments
POST: http://localhost:3030/authManagement
{ "action": "identityChange", "value": { "user": {"email": "aaa@live.com" }, "password": "xxxxx", "changes": {"email": "bbb@live.com"} } }
Both HTTP and Feathers call have the same issue, whatever password I have put there, it will assume the password is correct and send the verification email directly, after I clicked the url in email, the id(email) will successfully get updated.
Pretty strange, as far as I can see the CI is still running fine, there is a specific test on this. Could you provide more context/code sample ?
Just checked my code, I'm using "feathers-authentication-management-ts": "^2.1.2", not sure if this is the reason.
@MohammedFaragallah
From my understanding, once I installed the feathers-authentication-management, I can use
this.feathers.service('authManagement').create(data);
or regular HTTP method to call identityChange right?
{ "action": "identityChange", "value": { "user": {"email": "aaa@live.com" }, "password": "xxxxx", "changes": {"email": "bbb@live.com"} } }
Both of them have the same issue, I tried to hard code the password, then any password allows the method to send the email.
If your point is to use typescript please wait for this PR to be merged #164. @fratzinger is currently generating a pre-release.
thx a lot! that's great, we gonna have an official ts version!
any ideal when is this going to release? because I'm currently developing a project base on it.
npm i feathers-authentication-management@4.0.0-pre.0
It's alive. It's an early version though! There shouldn't be breaking changes. Please make sure to check out https://feathers-a-m.netlify.app/ .
Please let me know how it goes.
I just testet the identityChange
action in an app using the latest version (v3.1.0) of f-a-m. And I cannot confirm the reported issue. The service throws the expected "Password is incorrect." error.
@Millenniunn, what version are you using?
I just testet the
identityChange
action in an app using the latest version (v3.1.0) of f-a-m. And I cannot confirm the reported issue. The service throws the expected "Password is incorrect." error.@Millenniunn, what version are you using?
@OnnoGabriel Ya, im using the 3rd party ts version. going to try the pre-release version that @fratzinger just mentioned.
Thanks all!
npm i feathers-authentication-management@4.0.0-pre.0
It's alive. It's an early version though! There shouldn't be breaking changes. Please make sure to check out https://feathers-a-m.netlify.app/ .
Please let me know how it goes.
@fratzinger Thank you! going to try this version!
@fratzinger What's the proper way to export the notifier function with TS? I followed the .js instruction here but couldn't make it works.
https://feathers-a-m.netlify.app/getting-started.html#implementation-of-the-notifier-function
Another question, just curious, what's the point to use feathers-mailer? since I need to install nodemailer or nodemailer-smtp-transport for the transport anyway, why don't I just use the nodemailer to do all the jobs?
Thanks for the good explanation and screenshots! Highly appreciated!
There where a few errors in the guide. I fixed it in 8473dbe
Please look closely at the changes and follow the changes.
Last thing I see is the difference between type string
and NotificationType
in:
(type: NotificationType, user: User, notifierOptions?: any)
. It's in your first screenshot.
feathers-mailer
vs. nodemailer
. It's just a convenience level. I like to have all things in app
at my fingertips. Wether it is app.service(...)
or app.get(...)
. There where times I thought:
Nah, I don't need this elsewhere in the app. Just a quick hack here
and weeks later I saw me repairing the hack and moving it to a separate service with disallow('external')
@fratzinger Thank you for the quick response!
it does solved the error on user.hooks.ts (image 3 from my last post), but still getting error on auth-management.service.ts page.
Also two questions,
- is TS:
import notifier from './notifier'
same as JS:const notifier = require("./notifier");
? -
- is TS:
export default function (app: Application)
same as JS:module.exports =
?
- is TS:
not sure any of these may caused the issue.
@fratzinger I also just tried to follow the example in your branch, also got the error here
feathers-mailer
vs.nodemailer
. It's just a convenience level. I like to have all things inapp
at my fingertips. Wether it isapp.service(...)
orapp.get(...)
. There where times I thought:Nah, I don't need this elsewhere in the app. Just a quick hack here
and weeks later I saw me repairing the hack and moving it to a separate service with
disallow('external')
Isn't this same thing? I can also just use this app.service("mailer")
method to send emails with nodemailer
const email: Service<SendMailOptions> = app.service("mailer");
email.create(payload) .then(() => console.log("New ticket email sent successfully")) .catch(console.error)
@fratzinger I have finally figured it out..
I changed export default function (app: Application)
to module.exports = (app: Application) =>
in notifier.ts
and import notifier from './notifier'
to const notifier = require("./notifier");
in auth-management.service.ts
But Im still curious why... isn't module.exports
a JS method? what should be the proper way to write it? I have tried all those but didn't work.
One more thing... I didn't realize it should be addVerification("auth-management")
in the users.hook, cost me some time to debug.
This is weird since the regular JS branch doesn't need the "auth-management"
and your removeVerification()
also doesn't need it...
That's weird. But it has nothing todo with feathers-authentication-management
, I think. Do you have other export default
code in your code base that is working?
Please try the following:
// notifier.ts
export const notifier = (app: Application) => {
// auth-management.service.ts
import { notifier } from './notifier'
About "auth-management"
in addVerification
:
In v3 the recommended/default path of f-a-m
was: /authManagement
. addVerification
uses this as default.
I wanted to change the camelCase
to kebab-case
because this feels more natural. But I don't want to break the migration from v3 to v4. New people coming to f-a-m
just copy&paste the code from the docs and don't realize this.
That's weird. But it has nothing todo with
feathers-authentication-management
, I think. Do you have otherexport default
code in your code base that is working?Please try the following:
// notifier.ts export const notifier = (app: Application) => {// auth-management.service.ts import { notifier } from './notifier'
I have tried that before, not working as well.
About
"auth-management"
inaddVerification
: In v3 the recommended/default path off-a-m
was:/authManagement
.addVerification
uses this as default.I wanted to change the
camelCase
tokebab-case
because this feels more natural. But I don't want to break the migration from v3 to v4. New people coming tof-a-m
just copy&paste the code from the docs and don't realize this.
Thank you for the explanation!
And the identityChange issue is solved, thank you all. You may want to close the issue ticket anytime.