Exemple #1
0
 public function issue()
 {
     // 1 byte = 2^8 bits = 16^2 bits = 2 hex characters
     $key = bin2hex(random_bytes(config('osu.user.verification_key_length_hex') / 2));
     $user = $this->user;
     $email = $user->user_email;
     $to = $user->user_email;
     $this->request->session()->put('verification_key', $key);
     $this->request->session()->put('verification_expire_date', Carbon::now()->addHours(5));
     $this->request->session()->put('verification_tries', 0);
     $requestCountry = Country::where('acronym', $this->request->header('CF_IPCOUNTRY'))->pluck('name')->first();
     Mail::queue(['text' => i18n_view('emails.user_verification')], compact('key', 'user', 'requestCountry'), function ($message) use($to) {
         $message->to($to);
         $message->subject(trans('user_verification.email.subject'));
     });
 }
Exemple #2
0
 public function notifyReply($event)
 {
     $topic = $event->topic->fresh();
     $userIds = model_pluck(TopicWatch::where(['topic_id' => $topic->topic_id, 'notify_status' => false]), 'user_id');
     foreach (User::whereIn('user_id', $userIds)->get() as $user) {
         if (!present($user->user_email)) {
             continue;
         }
         if ($user->user_id === $topic->last_poster_id) {
             continue;
         }
         if (!priv_check_user($user, 'ForumTopicWatchAdd', $topic)->can()) {
             continue;
         }
         Mail::queue(['text' => i18n_view('emails.forum.new_reply')], compact('topic', 'user'), function ($message) use($topic, $user) {
             $message->to($user->user_email);
             $message->subject(trans('forum.email.new_reply', ['title' => $topic->topic_title]));
         });
         TopicWatch::where(['topic_id' => $topic->topic_id, 'user_id' => $user->user_id])->update(['notify_status' => true]);
     }
 }