Ejemplo n.º 1
0
    public function action_change_password()
    {
        \Util_security::check_method('POST');
        \Util_security::check_csrf();
        $form = $this->form_setting_password();
        $val = $form->validation();
        if ($val->run()) {
            $post = $val->validated();
            $data = array();
            $data['to_name'] = $this->u->username;
            $data['to_address'] = $this->u->email;
            $data['from_name'] = conf('mail.admin.from_name');
            $data['from_address'] = conf('mail.admin.from_email');
            $data['subject'] = term('site.password', 'form.update', 'form.complete') . 'の' . term('site.notice');
            $term_password = term('site.password');
            $data['body'] = <<<END
{$data['to_name']} 様

{$term_password}を変更しました。

END;
            try {
                \DB::start_transaction();
                $this->change_password($post['old_password'], $post['password']);
                \DB::commit_transaction();
                \Util_toolkit::sendmail($data);
                \Session::set_flash('message', term('site.password') . 'を変更しました。');
                \Response::redirect('admin/setting');
            } catch (\EmailValidationFailedException $e) {
                $this->display_error(term('site.password', 'form.update') . ': 送信エラー', __METHOD__ . ' email validation error: ' . $e->getMessage());
            } catch (\EmailSendingFailedException $e) {
                $this->display_error(term('site.password', 'form.update') . ': 送信エラー', __METHOD__ . ' email sending error: ' . $e->getMessage());
            } catch (\WrongPasswordException $e) {
                if (\DB::in_transaction()) {
                    \DB::rollback_transaction();
                }
                \Session::set_flash('error', sprintf('現在の%sが正しくありません。', term('site.password')));
            } catch (\FuelException $e) {
                if (\DB::in_transaction()) {
                    \DB::rollback_transaction();
                }
                \Session::set_flash('error', $e->getMessage());
            }
        } else {
            \Session::set_flash('error', $val->show_errors());
        }
        $this->action_password();
    }
Ejemplo n.º 2
0
    private function send_mail_create_user($data)
    {
        if (!is_array($data)) {
            $data = (array) $data;
        }
        $data['body'] = <<<END
メンバー登録が完了しました。

====================
ユーザ名: {$data['to_name']}
メールアドレス: {$data['to_address']}
仮パスワード: {$data['password']}
====================
※パスワードはログイン後、変更してください。

END;
        \Util_toolkit::sendmail($data);
    }
Ejemplo n.º 3
0
    private function send_account_lock_mail($data)
    {
        $data['subject'] = 'アカウントがロックされました';
        $data['body'] = <<<END
アカウントがロックされました。

====================
ログインに失敗したメールアドレス: {$data['login_failed_email']}
====================

END;
        if ($is_admin) {
            $data['body'] .= <<<END
管理者向け情報
====================
member_id: {$data['member_id']}
ニックネーム: {$data['member_name']}
====================

END;
        }
        Util_toolkit::sendmail($data);
    }