Question

In Meteor, how do i check if some input password string matches the currently logged-in user's actual password? I'm looking to have certain more sensitive settings only be able to be changed if you re-enter your password, similar to how github does sensitive stuff.

In the application I'm working on, a shift manager will sign into the meteor app at the beginning of the day, and this unlocks the UI for employees / cashiers to use until the manager signs out. However, while the manager is doing something else, if an employee tries to, say, edit the cash drawer totals, they'll be prompted for the manager's password. If they enter an incorrect password, it just shouldn't let them do that operation, but it shouldn't log them out.

Was it helpful?

Solution

Where userPassword is the user submitted password. Note there is no underscore before id.

Meteor.loginWithPassword({id: localStorage['Meteor.userId'] }, userPassword, function (error) {
    if(!error) {
        // good to go.
    } else {
        // not this time, pal.
    }
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top