Ejemplo n.º 1
0
 /**
  * Put a comment
  *
  * @param CommentEntity $comment comment instance
  * @return CommentEntity
  */
 public function put(CommentEntity $comment)
 {
     $config = $this->configs->get($this->getConfigKey($comment->instanceId));
     if ($config->get('useWysiwyg') === true) {
         $comment->html = 1;
     }
     $updated = $this->repo->update($comment);
     return $this->member->associate($updated);
 }
 /**
  * retreiveMember
  *
  * @param $id
  *
  * @return mixed
  */
 protected function retreiveMember($id)
 {
     $member = $this->handler->find($id, ['groups', 'accounts', 'mails']);
     if ($member === null) {
         $member = $this->handler->fetchOneMember(['displayName' => $id], ['groups', 'accounts', 'mails']);
     }
     if ($member === null) {
         throw MemberNotFoundException();
     }
     return $member;
 }
 public function deleteMember()
 {
     $memberIds = Input::get('id', []);
     XeDB::beginTransaction();
     try {
         $this->handler->leave($memberIds);
     } catch (Exception $e) {
         XeDB::rollBack();
         throw $e;
     }
     XeDB::commit();
     return redirect()->back()->with('alert', ['type' => 'success', 'message' => '삭제되었습니다.']);
 }
Ejemplo n.º 4
0
 private function memberEditView(MemberEntityInterface $member)
 {
     // dynamic field
     $dynamicField = app('xe.dynamicField');
     $fieldTypes = $dynamicField->gets('member');
     // password configuration
     $passwordConfig = app('config')->get('xe.member.password');
     $passwordLevel = array_get($passwordConfig['levels'], $passwordConfig['default']);
     $useEmailConfirm = $this->handler->usingEmailConfirm();
     app('xe.frontend')->js('assets/member/settings.js')->load();
     app('xe.frontend')->html('member.settings.loadScript')->content("<script>\n            XE.\$(function () {\n                \$('.__xe_setting.__xe_settingDisplayName').xeDisplayNameSetting({\n                    checkUrl: '" . route('member.settings.name.check') . "',\n                    saveUrl: '" . route('member.settings.name.update') . "'\n                });\n                \$('.__xe_setting.__xe_settingPassword').xePasswordSetting({\n                    checkUrl: '" . route('member.settings.password.check') . "',\n                    saveUrl: '" . route('member.settings.password.update') . "'\n                });\n                \$('.__xe_setting.__xe_settingEmail').xeEmailSetting({\n                    addUrl: '" . route('member.settings.mail.add') . "',\n                    saveUrl: '" . route('member.settings.mail.update') . "',\n                    deleteUrl: '" . route('member.settings.mail.delete') . "',\n                    confirmUrl: '" . route('member.settings.mail.confirm') . "',\n                    deletePendingUrl: '" . route('member.settings.pending_mail.delete') . "',\n                    resendPendingUrl: '" . route('member.settings.pending_mail.resend') . "',\n                    useEmailConfirm: " . ($useEmailConfirm ? 'true' : 'false') . "\n                });\n                \$('.__xe_setting.__xe_settingLeave').xeLeaveSetting({\n                    saveUrl: '" . route('member.settings.leave') . "'\n                });\n            });\n            </script>")->appendTo('body')->load();
     /** @var SkinHandler $skinHandler */
     $skinHandler = app('xe.skin');
     $skin = $skinHandler->getAssigned('member/settings');
     return $skin->setView('edit')->setData(compact('member', 'fieldTypes', 'passwordLevel'));
 }
 /**
  * Reset the given user's password.
  *
  * @param  Request  $request
  * @return Response
  */
 public function postPassword(Request $request)
 {
     $this->validate($request, ['token' => 'required', 'email' => 'required|email', 'password' => 'required|confirmed']);
     $credentials = $request->only('email', 'password', 'password_confirmation', 'token');
     $response = $this->passwords->reset($credentials, function ($user, $password) {
         $user->password = bcrypt($password);
         $this->handler->update($user);
         $this->auth->login($user);
     });
     switch ($response) {
         case PasswordBroker::PASSWORD_RESET:
             return redirect('/')->with('status', $response);
         default:
             // password configuration
             $passwordConfig = app('config')->get('xe.member.password');
             $passwordLevel = array_get($passwordConfig['levels'], $passwordConfig['default']);
             return redirect()->back()->withInput($request->only('email'))->with('alert', ['type' => 'danger', 'message' => $passwordLevel['description']]);
     }
 }
Ejemplo n.º 6
0
 /**
  * Handle a registration request for the application.
  *
  * @param  \Illuminate\Http\Request $request
  *
  * @return \Illuminate\Http\Response
  */
 public function postRegister(Request $request)
 {
     // validation
     $this->checkJoinable();
     $this->checkCaptcha('join');
     $validate = \Validator::make($request->all(), ['email' => 'email|required|unique:member_mails,address', 'displayName' => 'required', 'password' => 'required|confirmed|password', 'agree' => 'required']);
     if ($validate->fails()) {
         $e = new InvalidArgumentException();
         $e->setMessage($validate->errors()->first());
         throw $e;
     }
     // resolve data
     $memberData = $request->except('_token');
     $memberData['rating'] = Rating::MEMBER;
     $memberData['status'] = Member::STATUS_ACTIVATED;
     unset($memberData['password_confirmation']);
     XeDB::beginTransaction();
     try {
         $member = $this->handler->create($memberData);
         $mail = $member->getPendingEmail();
     } catch (\Exception $e) {
         XeDB::rollback();
         throw $e;
     }
     XeDB::commit();
     // if email confirmation enabled, send email for confirm
     if ($this->useEmailConfirm() !== false) {
         try {
             /** @var EmailBrokerInterface $broker */
             $this->emailBroker->sendEmailForConfirmation($mail);
         } catch (Exception $e) {
             throw $e;
         }
         // redirect to email confirm info page
         return redirect()->route('auth.confirm', ['email' => $member->email])->with('alert', ['type' => 'info', 'message' => '회원가입이 정상적으로 처리되었습니다. 회원계정을 활성화하려면 이메일 인증을 하셔야 합니다.']);
     }
     // login and redirect
     $this->auth->login($member);
     return redirect($this->redirectPath());
 }