Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make user-login optional in verifyPhone method #21

Open
ChenLi0830 opened this issue Mar 3, 2016 · 2 comments
Open

Make user-login optional in verifyPhone method #21

ChenLi0830 opened this issue Mar 3, 2016 · 2 comments

Comments

@ChenLi0830
Copy link

Hi there, I am using the package and I find it very helpful so far, thank you very much for it.

I'm wondering if you could make user-login an optional action in verifyPhone method? I want to show users a welcome page after they successfully register, but currently I can't do it because the verifyPhone function will bring them directly into the main page.

Thanks!
Yichen

@ahmedtabrez
Copy link

@ChenLi0830, Perform phone verification on server side. The user won't be logged in.

@ChenLi0830
Copy link
Author

@ahmedtabrez, thanks for your reply. It works like a charm. However, when reading the code I got confused what prevented the 'login' process from happening. To me it seems all Account.verifyPhone method does is checking the params, and then directly call the server method 'verifyPhone'. Clearly, there is something I missed, but I don't know what it is.

Here is the code I looked at in phone_client.js in the package

Accounts.verifyPhone = function (phone, code, newPassword, callback) {
    check(code, String);
    check(phone, String);

    var hashedPassword;

    if (newPassword) {
        // If didn't gave newPassword and only callback was given
        if (typeof(newPassword) === 'function') {
            callback = newPassword;
        } else {
            check(newPassword, String);
            hashedPassword = Accounts._hashPassword(newPassword);
        }
    }
    Accounts.callLoginMethod({
        methodName     : 'verifyPhone',
        methodArguments: [phone, code, hashedPassword],
        userCallback   : callback});
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants