account.js 2.26 KB
/**
 * [个人中心]个人设置-账户安全部分
 * @author: jiangmin
 * @date: 2016/07/13
 */

'use strict';

const api = global.yoho.API;


/**
 * 验证用户登录密码是否正确
 * @param  uid
 * @param  password
 * @return type
 */
const verifyPwd = (uid, password)=> {
    return api.get('', {
        method: 'web.passport.verifyUserPwd',
        uid: uid,
        password: password
    }).then(result => result);
};

/**
 * 修改密码
 * @param uid
 * @param pwd
 * @returns {*}
 * @private
 */

const changePwd = (uid, pwd)=> {
    return api.get('', {
        method: 'web.passport.changePwd',
        uid: uid,
        newPassword: pwd
    }).then(result => result);
};


/**
 * 发送手机验证
 * @param uid
 * @param mobile
 * @param area
 */
const sendMobileMsg = (uid, mobile, area)=> {
    return api.get('', {
        method: 'web.passport.sendcode',
        uid: uid,
        mobile: mobile,
        area: area
    }).then(result => result);
};

/**
 * 验证短信验证码
 * @param code
 * @param mobile
 * @param area
 */
const checkVerifyMsg = (code, mobile, area)=> {
    return api.get('', {
        method: 'web.passport.checkcode',
        code: code,
        mobile: mobile,
        area: area
    }).then(result => result);
};

/**
 * 发送验证邮箱
 * @param uid
 * @param email
 */
const sendVerifyEmail = (uid, email)=> {
    return api.get('', {
        method: 'web.passport.verifyEmail',
        uid: uid,
        email: email
    }).then(result => result);
};

/**
 * 修改手机号前校验
 * @param  uid
 * @param  mobile
 * @param area
 */
const checkVerifyMobile = (uid, mobile, area)=> {
    return api.get('', {
        method: 'web.passport.checkVerifyMobile',
        uid: uid,
        mobile: mobile,
        area: area
    }).then(result => result);
};

const modifyVerifyMobile = (uid, area, newMobile)=> {
    return api.get('', {
        method: 'web.passport.changeVerifyMobile',
        uid: uid,
        newMobile: newMobile,
        area: area
    }).then(result => result);
};

module.exports = {
    verifyPwd: verifyPwd,
    changePwd: changePwd,
    sendMobileMsg: sendMobileMsg,
    checkVerifyMsg: checkVerifyMsg,
    sendVerifyEmail: sendVerifyEmail,
    checkVerifyMobile: checkVerifyMobile,
    modifyVerifyMobile: modifyVerifyMobile
};