Ejemplo n.º 1
0
 public function screen_modify_pass()
 {
     $this->make_member_modify_pass_form();
     $btn1 = "";
     $btn2 = "";
     if (!$this->form->validate()) {
         $this->action = "form";
     }
     if ($this->action == "form") {
         $this->file = "member_modify_pass.tpl";
         $this->title = "パスワード・変更ページ";
         $this->next_type = "modify_pass";
         $this->next_action = "complete";
         $btn1 = "変更";
         $btn2 = "";
     } else {
         if ($this->action == "complete" && isset($_POST['submit1']) && $_POST['submit1'] == "変更") {
             $data = $this->form->getSubmitValues();
             if (!$this->auth->check_pass($_SESSION[_MEMBER_AUTHINFO]['password'], $data['password_old'])) {
                 $this->file = "member_modify_pass.tpl";
                 $this->title = "パスワード・変更ページ";
                 $this->message = "現在のパスワードが間違っています。<br>もう一度、間違えると元のページに戻ります!!";
                 $this->type = "modify_pass";
                 $this->action = "complete";
                 $btn1 = "変更";
                 $btn2 = "";
             } else {
                 $MemberModel = new MemberModel();
                 $data[] = "";
                 $data['password'] = $this->auth->get_hash_password($data['password_new1']);
                 $data['id'] = $_SESSION[_MEMBER_AUTHINFO]['id'];
                 $MemberModel->modify_member_pass($data);
                 $_SESSION[_MEMBER_AUTHINFO]['password'] = $data['password'];
                 $this->file = "message.tpl";
                 $this->title = "パスワードの変更が完了しました";
                 $this->message = "下記よりトップページに戻ってください";
             }
         }
     }
     $this->form->addElement('submit', 'submit1', $btn1);
     $this->form->addElement('submit', 'submit2', $btn2);
     $this->form->addElement('reset', 'reset', '取り消し');
     $this->view_display();
 }