Userpwd.php 4.06 KB
<?php

use Action\WebAction;
use WebPlugin\Helpers;
use Home\UserModel;
use Home\AddressModel;
use Home\ReturnsModel;
use LibModels\Web\Home\UserData;
use LibModels\Web\Home\AddressData;

/**
 * 个人中心 修改密码
 */

class UserpwdController extends WebAction
{
    /**
     * 个人中心-设置新密码
     */
    public function newpwdAction()
    {
        //判断是否登录
        $this->auditJumpLogin();

        //头部导航
        $channel = Helpers::getChannelNameByCookie();
        $this->setWebNavHeader($channel);
        //面包屑-左侧导航
        $path = UserModel::getCenterCrumb('账号安全');
        $leftNav = UserModel::getCenterLeftNav('账号安全');
        //用户信息

        $data = array(
            'path' => $path,
            'homeNav' => $leftNav,
            'subTitle' => '修改密码',
            'enTitle' => 'CHANGE PASSWORD',
            'progressCur' => 'progress2',
            'progress' => array(
                array(
                    'iscur' => false,
                    'progressName' => '1.验证身份'
                ),
                array(
                    'iscur' => true,
                    'progressName' => '2.修改登录密码'
                ),
                array(
                    'iscur' => false,
                    'progressName' => '3.完成'
                )
            ),
            'formInfo' => array(
                'formAction' => '/home/userpwd/modpwd',
                'formData' => array(
                    array(
                        'inputTxt' => '输入新密码',
                        'key' => 'password',
                        'type' => 'password',
                        'name' => 'password'
                    ),
                    array(
                        'inputTxt' => '确认新密码',
                        'key' => 'confirm_password',
                        'type' => 'password',
                        'name' => 'confirm_password'
                    )            
                )
            )
        );

        $this->_view->display('../../index/home/userpwd', array(
            'userpwd' => $data,
            'meValidatePage' => true
        ));
    }

    /**
    * 个人中心 -邮箱验证结果返回
    */
    public function modpwdAction()
    {
        //判断是否登录
        $this->auditJumpLogin();

        //头部导航
        $channel = Helpers::getChannelNameByCookie();
        $this->setWebNavHeader($channel);
        //面包屑-左侧导航
        $path = UserModel::getCenterCrumb('账号安全');
        $leftNav = UserModel::getCenterLeftNav('账号安全');
        //用户信息

        $data = array(
            'path' => $path,
            'homeNav' => $leftNav,
            'subTitle' => '修改密码',
            'enTitle' => 'CHANGE EMAIL',
            'progressCur' => 'progress3',
            'progress' => array(
                array(
                    'iscur' => false,
                    'progressName' => '1.验证身份'
                ),
                array(
                    'iscur' => false,
                    'progressName' => '2.修改登录密码'
                ),
                array(
                    'iscur' => true,
                    'progressName' => '3.完成'
                )
            ),
            'returnInfo' => true,
            'complete' => array(
                'resInfo' => '恭喜你,密码修改成功!'
            )
        );

        $this->_view->display('../../index/home/email', array(
            'email' => $data,
            'meValidatePage' => true
        ));
    }

    /**
     * 通过当前用户审判是否跳到登录
     *
     * @param int $useSession (true:从服务端session中检查, false:从客户端cookie中检查)
     * @return void
     */
    protected function auditJumpLogin($useSession = true)
    {
        $uid = $this->getUid($useSession);
        if (!$uid) {
            $this->go(Helpers::url('/signin.html', array('refer' => $this->server('HTTP_REFERER', SITE_MAIN))));
        }
        else {
            return $uid;
        }
    }
}