User password validation

Hi,

I’m starting with Realm Web and I’m wondering how do you validate user password during registration? Should i use a realm function to validate email and password and then call the realm register api function ?

I’m also wondering how do you validate user form in general, do you have to create a custom resolver, or create a validation schema on the collection(s), or something else?

Thanks for your help.

Hi @David_N_A,

Welcome and good luck with Realm.

As part of email password config you are required to set the way you confirm users:

https://docs.mongodb.com/realm/authentication/email-password/#configuration

It can be a built-in eMail verification or a function where you can write your own logic.

However, the flow mus start with sdk registration methods.

Best
Pavel

Thank you, that’s what I was looking for !
As for validating user inputs on the server side do I have to use mongodb schema validation and graphql customer resolvers. Is this how I have to validate user inputs and get error messages back that I handle on forms ?

Thanks.

Well that depends on what you are validating… If its your documents structure then using schema validation in https://docs.mongodb.com/realm/mongodb/document-schemas/ rules make sense:

Pavel.

Do I have to wrap registration in a realm function so that I can validate the password?

Let’s say i’m building an api and I have a userProfile endpoint. This endpoint should be able to validate and return error messages.
Or let’s say i have a user profile form on the website, I should be able to get validation error messages from graphql.

Actually with a confirmation function the password doesn’t seem to be passed. How can I validate the password format server side ?