What to do after user clicks vertification link? React native meteor accounts

Hi
I am trying to configure meteors account vertification system.I have managed to send vertification mails to registered users withAccounts.config({sendVerificationEmail: true});
I have also noticed that when user clicks to the link it adds vertificationToken to database and redirects user to the index page.I am using meteor just as a backend for a mobile app.I would like to redirect user to a custom page after clicking vertification link,not to the index page.How do i do that ?

Another thing is how do i use that vertificationToken to make verified= true under users document ? So i can check that value before user logs in and act based on that.

Tried this in server side:

Accounts.onEmailVerificationLink((token, done) => {
    Accounts.verifyEmail(token, (err) => {
        if (err) {
            console.log("Error: ", err);
        } else {
            console.log("Success");
            
        }
    });
});

but i get TypeError: Accounts.onEmailVerificationLink is not a function error.I just want to verify the account not automaticly log in user.

thanks

You need that code on the client, not the server. Then you can redirect

Where should i exactly put that ? to register page or login page ? what if client is offline ? should run that after user trys to login ?

You should put it somewhere in your client code - I use a custom vroute in flowrouter, with custom functionality.

If the user is offline the email verification will fail - as it requires an internet connection. You should probably check for that before calling Accounts.verifyEmail

I am using react-native meteors account package.I guess this is not working with it

Ah, sadly I have no experience with that, sorry :frowning:

1 Like

I will try to solve this problem by sending vertification code not a link

I changed my system to send first 4 character of token so user enters it to app to verify his account its working this way