imports/vx/client/code/vxapp.js
/**
     * Handle normal signin passing email, password and potentially 2FA token to Meteor login subsystem.
     * This is a heavily-customized approach using a very poorly-documented API.
     *
     * @param {object} state React state of sign-in component.
     * @param {function} callback Callback bearing either error or results.
     */
Handle normal signin passing email, password and potentially 2FA token to Meteor login subsystem.
This is a heavily-customized approach using a very poorly-documented API.

@param {object} state React state of sign-in component.
@param {function} callback Callback bearing either error or results.
Handle normal signin passing email password and potentially 2FA token to Meteor login subsystem . This is a heavily - customized approach using a very poorly - documented API . @param { object } state React state of sign - in component . @param { function } callback Callback bearing either error or results .
handleSignin(state, callback) {
        const { email, password, token, doNotAskAgain } = state
        Accounts.callLoginMethod({
            methodArguments: [{
                user: { email },
                twoFactorPassword: Accounts._hashPassword(password),
                twoFactorToken: token,
                doNotAskAgain: doNotAskAgain,
                twoFactorHash: UX.getLocalStorageWithExpiry(CX.LOCAL_STORAGE_TWO_FACTOR_HASH_KEY)
            }],
            validateResult: (result) => {
                if (!token) {
                    return
                }
                if (doNotAskAgain) {
                    OLog.warn(`vxapp.handleSignin email=${email} token=${token} doNotAskAgain=${doNotAskAgain} *setting* local storage`)
                    UX.setLocalStorageWithExpiry(CX.LOCAL_STORAGE_TWO_FACTOR_HASH_KEY, result.twoFactorHash,
                        CX.LOCAL_STORAGE_TWO_FACTOR_HASH_TTL)
                }
                else {
                    OLog.warn(`vxapp.handleSignin email=${email} token=${token} doNotAskAgain=${doNotAskAgain} *removing* local storage`)
                    UX.removeLocalStorageWithExpiry(CX.LOCAL_STORAGE_TWO_FACTOR_HASH_KEY)
                }
            },
            userCallback: callback
        })
    }
handleSignin ( state , callback ) { const { email , password , token , doNotAskAgain } = state Accounts . callLoginMethod ( { methodArguments : [ { user : { email } , twoFactorPassword : Accounts . _hashPassword ( password ) , twoFactorToken : token , doNotAskAgain : doNotAskAgain , twoFactorHash : UX . getLocalStorageWithExpiry ( CX . LOCAL_STORAGE_TWO_FACTOR_HASH_KEY ) } ] , validateResult : ( result ) => { if ( ! token ) { return } if ( doNotAskAgain ) { OLog . warn ( ` ${ email } ${ token } ${ doNotAskAgain } ` ) UX . setLocalStorageWithExpiry ( CX . LOCAL_STORAGE_TWO_FACTOR_HASH_KEY , result . twoFactorHash , CX . LOCAL_STORAGE_TWO_FACTOR_HASH_TTL ) } else { OLog . warn ( ` ${ email } ${ token } ${ doNotAskAgain } ` ) UX . removeLocalStorageWithExpiry ( CX . LOCAL_STORAGE_TWO_FACTOR_HASH_KEY ) } } , userCallback : callback } ) }
Handle normal signin passing email, password and potentially 2FA token to Meteor login subsystem.
Handle normal signin passing email password and potentially 2FA token to Meteor login subsystem .