Inheritance: extends Service
 /**
  * Configに合わせてメール通知HTMLコンポーネントを返す
  *
  * @return View | null
  */
 protected function renderHtml()
 {
     if ($this->notifyEnable) {
         $notifyFlags = $this->mailNotifyService->getSettings($this->userService->getCurrentUser()->id);
         return view('user.edit._mail-notify', compact('notifyFlags'))->render();
     }
     return null;
 }
Exemple #2
0
 /**
  * 記事が編集された時
  *
  * @param EditEvent $event
  */
 public function onItemEdited(EditEvent $event)
 {
     $item = $this->itemService->getByOpenItemId($event->getId());
     if (!$this->itemShouldNotified($item)) {
         return;
     }
     $user = $this->userService->getById($event->getUserId());
     $this->slackUtils->postEditMessage($item, $user);
 }
Exemple #3
0
 /**
  * Retrieve a user by the given credentials.
  *
  * @param array $credentials
  * @return \Illuminate\Contracts\Auth\Authenticatable|null
  */
 public function retrieveByCredentials(array $credentials)
 {
     // Do not allowing login without password.
     if (!array_key_exists('password', $credentials)) {
         return;
     }
     unset($credentials['password']);
     $user = $this->userService->getUser($credentials);
     return $this->getOwlUser($user);
 }
Exemple #4
0
 public function checkPassword($username, $password)
 {
     // DBからハッシュされているパスワードを取得
     $user_db = $this->userService->getByUsername($username);
     if (!isset($user_db->id)) {
         return false;
         // そんな名前のユーザーはいません
     }
     if (password_verify($password, $user_db->password)) {
         return true;
     }
     return false;
 }
Exemple #5
0
 /**
  * 記事が編集された時
  *
  * @param EditEvent  $event
  */
 public function onItemEdited(EditEvent $event)
 {
     $item = $this->itemService->getByOpenItemId($event->getId());
     $recipient = $this->userService->getById($item->user_id);
     $sender = $this->userService->getById($event->getUserId());
     if ($this->userRoleService->isRetire($recipient->id)) {
         return false;
     }
     if ($this->areUsersSame($recipient, $sender)) {
         return false;
     } elseif (!$this->notificationIsEnabled('edit', $recipient->id)) {
         return false;
     }
     $this->mail->send('emails.action.edit', $this->getDataForMail($item, $recipient, $sender), function ($m) use($recipient, $sender) {
         $m->to($recipient->email)->subject('あなたの記事が' . $sender->username . 'さんに編集されました - Owl');
     });
 }
Exemple #6
0
 /**
  * 設定を更新
  *
  * @param Request            $request
  * @param UserService        $userService
  * @param MailNotifyService  $mailNotifyService
  *
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, UserService $userService, MailNotifyService $mailNotifyService)
 {
     $params = $request->only(['type', 'flag']);
     $result = $mailNotifyService->updateSetting($userService->getCurrentUser()->id, $params['type'], $params['flag']);
     return response()->json(['result' => $result]);
 }