<div class="header_menu">
    <div class="container">
        <div class="header-nav clearfix">
            <?php echo $this->partial('shop/layout/headerMenu'); ?>
        </div>
    </div>
</div>
</div>

<?php
$form = $this->form;
$form->prepare();
$form->setAttributes(['class' => 'form-horizontal']);

$form->get('userPassword')->setAttributes([
    'class' => 'span3',
    'placeholder' => $this->translate('请输入新的登录密码')
]);
$form->get('userComPassword')->setAttributes([
    'class' => 'span3',
    'placeholder' => $this->translate('请输入确认密码')
]);
?>

<div class="container">
    <div class="xm-plain-box">
        <div class="box-hd">
            <h3 class="title"><?php echo $this->translate('重新设置密码'); ?></h3>
        </div>
        <div class="box-bd">
            <div class="row">
                <?php echo $this->form()->openTag($form); ?>
                <?php echo $this->formElement($form->get('shopCsrf')); ?>
                <?php echo $this->formElementErrors($form->get('shopCsrf'), ['class'=>'error-message']); ?>
                    <div class="control-group">
                        <label for="input01" class="control-label"><?php echo $this->translate('会员名称'); ?>：</label>
                        <div class="controls">
                            <?php echo $this->escapeHtml($this->userInfo->getUserName()); ?>
                        </div>
                    </div>
                    <div class="control-group">
                        <label for="input01" class="control-label"><?php echo $this->translate('会员新密码'); ?>：</label>
                        <div class="controls">
                            <?php echo $this->formElement($form->get('userPassword')); ?>
                            <?php echo $this->formElementErrors($form->get('userPassword'), ['class'=>'error-message']); ?>
                        </div>
                    </div>
                    <div class="control-group">
                        <label for="input01" class="control-label"><?php echo $this->translate('确认密码'); ?>：</label>
                        <div class="controls">
                            <?php echo $this->formElement($form->get('userComPassword')); ?>
                            <?php echo $this->formElementErrors($form->get('userComPassword'), ['class'=>'error-message']); ?>
                        </div>
                    </div>
                    <div class="control-group">
                        <div class="controls">
                            <button class="btn btn-primary" type="submit"><?php echo $this->translate('提交设定新密码'); ?></button>
                        </div>
                    </div>
                <?php echo $this->form()->closeTag(); ?>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(document).ready(function() {
        $("#<?php echo $form->getName(); ?>").validate({
            rules: {
                userPassword: {
                    required: true,
                    minlength: 6
                },
                userComPassword: {
                    required: true,
                    minlength: 6,
                    equalTo: '#userPassword'
                }
            },
            messages: {
                userPassword: {
                    required: "<?php echo $this->translate('请输入新的登录密码!'); ?>",
                    minlength: "<?php echo $this->translate('至少输入6位密码!'); ?>",
                    maxlength: "<?php echo $this->translate('密码最长为20位!'); ?>"
                },
                userComPassword: {
                    required: "<?php echo $this->translate('请输入确认密码!'); ?>",
                    minlength: "<?php echo $this->translate('至少输入6位确认密码!'); ?>",
                    equalTo: "<?php echo $this->translate('两次输入的密码不一致!'); ?>"
                }
            }
        });
    });
</script>