https://supertokens.com/ logo
Title
u

γƒ”γƒ§γƒˆγƒ«πŸΊ

02/10/2023, 2:26 PM
Hi, Can I overrode email and password validation? I have: emailPasswordSignUp: async function (input) { const existingUsers = await ThirdPartyEmailPassword.getUsersByEmail(input.email); if (existingUsers.length === 0) { const inputWithGoodValues: SuperTokensUsersPipe = { email: input.email, password: input.password, }; return originalImplementation.emailPasswordSignUp({ email: inputWithGoodValues.email, password: inputWithGoodValues.password, userContext: input.userContext, }); } return { status: 'EMAIL_ALREADY_EXISTS_ERROR', }; }, but this is ignoring.
r

rp

02/10/2023, 2:32 PM
hey @γƒ”γƒ§γƒˆγƒ«πŸΊ
which recipe?
u

γƒ”γƒ§γƒˆγƒ«πŸΊ

02/10/2023, 8:22 PM
ThirdPartyEmailPassword
r

rp

02/10/2023, 8:46 PM
Can I see the full thirdpartyemailpassword.init?
u

γƒ”γƒ§γƒˆγƒ«πŸΊ

02/10/2023, 9:03 PM
ok
Discord converted text to txt file xd
r

rp

02/11/2023, 4:37 AM
Hmmm. So the override is not getting called at all?
u

γƒ”γƒ§γƒˆγƒ«πŸΊ

02/11/2023, 1:07 PM
I don't know so I asked here.
r

rp

02/11/2023, 1:46 PM
Can you add a console log at the start of the override and then call the email password sign up API?
u

γƒ”γƒ§γƒˆγƒ«πŸΊ

02/11/2023, 4:50 PM
I added: https://supertokens.com/docs/thirdpartyemailpassword/troubleshooting/how-to-troubleshoot but happened nothing :/ I even have " 11 Feb 2023 16:45:38:635 +0000 | INFO | pid: 709432c2-c889-4cf1-948b-45a6f706acf9 | [http-nio-0.0.0.0-3567-exec-2] thread | io.supertokens.webserver.WebserverAPI.service(WebserverAPI.java:186) | API ended: /telemetry. Method: GET " When I use sign up, I get: { "status": "FIELD_ERROR", "formFields": [ { "error": "Password must contain at least 8 characters, including a number", "id": "password" } ] } I should be 9 and has big chars too.
By the way, I found out that it doesn't fire up my email sending.
emailDelivery: { override: () => { return { sendEmail: async function (input) { const data = await usersService.users({ where: { id: input.user.id }, }); await send({ templateVersion: templates.forgottenPassword, verificationUrl: input.passwordResetLink, email: input.user.email, emails: emails.forgottenPasswordEmail, title: titles.forgotten, username:
${data[0].username}!
, }); }, }; }, }, }),
r

rp

02/11/2023, 4:53 PM
I’m not sure why these functions aren’t working for you. There may be something small that’s misconfigured
I would suggest that you see one of our example apps from our cli
And use that as a basis to start
If you are getting a field error during sign up, try a password like abcd1234. That should work
If it doesn’t, try and step through the stack.
u

γƒ”γƒ§γƒˆγƒ«πŸΊ

02/11/2023, 4:55 PM
wrong last code xd
EmailVerification.init({ mode: 'REQUIRED', emailDelivery: { override: () => { return { sendEmail: async function (input) { await send({ templateVersion: templates.confirmEmail, verificationUrl: input.emailVerifyLink, email: input.user.email, emails: emails.confirmEmail, title: titles.confirm, username: '', }); }, }; }, }, }),
This is ok
r

rp

02/11/2023, 4:55 PM
I’m not sure I can help out anymore cause your questions are very vague and I can’t really see your app’s code
u

γƒ”γƒ§γƒˆγƒ«πŸΊ

02/11/2023, 4:56 PM
I only mean validation user. I create users correct
r

rp

02/11/2023, 4:57 PM
I’m not sure I understand
If you want to change validation rules, checkout the section in our docs about form field validators
u

γƒ”γƒ§γƒˆγƒ«πŸΊ

02/11/2023, 4:58 PM
Ok, I'll check
I override email delivery but when user is created, this isn't work. My function is not called and I don't know why.
@rp do you know why?
Logs from creating (correct) user: i { email: 'support@pfartists.xyz', password: 'tessqqq1', userContext: { _default: { request: [ExpressRequest] } } } exist [] new { email: 'support@pfartists.xyz', password: 'tessqqq1' }
r

rp

02/11/2023, 5:04 PM
Email verification is a different api. It’s not the same as the sign up api
u

γƒ”γƒ§γƒˆγƒ«πŸΊ

02/11/2023, 5:05 PM
"exist []" so this user doesn't exist
r

rp

02/11/2023, 5:05 PM
Please see our guides for custom ui, please see our demo apps.
u

γƒ”γƒ§γƒˆγƒ«πŸΊ

02/11/2023, 5:07 PM
Can you add link? I was thinking that if I have REQUIRED, this function 'll work after created user :/
r

rp

02/11/2023, 5:07 PM
You need to call our email verification api from the frontend
The required mode essentially adds the email verification status into the session and makes the verifySession function check for the status
u

γƒ”γƒ§γƒˆγƒ«πŸΊ

02/11/2023, 5:10 PM
SO when user do sign up, I need ... what? :/ I'm starting to get lost. ANd I don't check in POstman? I'm using https://supertokens.com/docs/thirdpartyemailpassword/testing/testing-with-postman
r

rp

02/11/2023, 5:10 PM
See our guide for building your own ui please
If you are using our pre built ui, then all the email verification stuff happens on its own
And you can follow the api calls in the network tab
u

γƒ”γƒ§γƒˆγƒ«πŸΊ

02/11/2023, 5:13 PM
I already found but you already sent before me xddd I've had to embrace verylot lately xdd I think I need to slow down xd
And can I somehow get the email sending to work in Postman or is that impossible?
r

rp

02/11/2023, 5:15 PM
Yes. U can. Call the login api first in postman. And then call the send email api
u

γƒ”γƒ§γƒˆγƒ«πŸΊ

02/11/2023, 5:23 PM
Can you add api name or link? πŸ˜…
r

rp

02/11/2023, 5:23 PM
Please see our api spec
Supertokens.com/docs/fdi
u

γƒ”γƒ§γƒˆγƒ«πŸΊ

02/11/2023, 5:23 PM
Thanks πŸ™‚
@rp I'll let it go xd I don't know what exactly the "body" of the request should look like and how to do the token to avoid problems. I only know that the token has 128 characters. But I learned something again. Thanks for your help :)