/** * 仮登録完了画面 * ユーザ登録実行後、アクティベートURLを含む認証メールをユーザに送付します * ユーザ作成箇所につきこの箇所のみCSRFチェックを実行いたします。 * * @todo エラーメッセージのview側への組み込み * @todo 検討: emailにunique制約が入っており、ここで中途半端にページを閉じると同じIDで登録できない * @todo confirmでリロードした後にこの画面に遷移すると、passwordがとれずユーザが発行されない * @todo ユーザの作成からトークン発行までをtransaction処理にする * @author shimma * @access public * @return void */ public function post_verify() { if (!Security::check_token()) { throw new SystemException(\Model_Error::ER00301); } $fieldset = self::createFieldset(); $properties = array_filter($fieldset->validation()->validated(), 'strlen'); try { $new_user = Model_User::createNewUser($properties['email'], $properties['password'], $properties); $new_token = Model_Token::generate($new_user->user_id); $email_template_params = array('nick_name' => $new_user->nick_name, 'activate_url' => $new_token->getActivationUrl()); $new_user->sendmail('signup/verify', $email_template_params); } catch (Exception $e) { throw $e; } $this->template->content = View::forge('signup/verify'); $this->template->content->set('user_input', $properties); }
/** * リマインダメール送信 * * @access public * @return void * @author shimma */ public function post_submit() { if (!Security::check_token()) { return \Response::redirect('errors/doubletransmission'); } $fieldset = self::createFieldset(); $validation = $fieldset->validation(); Session::set_flash('reminder.email.fieldset', $fieldset); if (!$validation->run()) { return \Response::redirect('/reminder'); } try { $reset_user = Model_User::find('last', array('where' => array(array('email' => $fieldset->input('email'))))); if ($reset_user) { $new_token = Model_Token::generate($reset_user->user_id); $email_template_params = array('nick_name' => $reset_user->nick_name, 'reset_password_url' => $new_token->getVelificationUrl('reset_password')); $reset_user->sendmail('reminder/submit', $email_template_params); } } catch (Orm\ValidationFailed $e) { return \Response::redirect('errors/timeout'); } $this->template->content = View::forge('reminder/submit'); }