האם יש דרך להאזין לאירוע כניסת משתמש באמצעות רכיב Theme

Hey @Saurabh_Khandelwal :wave:

I would advise against doing it this way; login is one of the most critical actions, and any overrides to that action will be fragile and prone to breaking if we make any changes in the area in core.

If you recall, when you first signed up on this site, you saw something like this.

The conditions we use to check for this are

!user.read_first_notification && !user.enforcedSecondFactor

So, if you use the same conditions in an initializer, you’ll be able to render a Bootbox on the user’s very first-page view after login.

You can try something like this in your theme component.

import { withPluginApi } from "discourse/lib/plugin-api";
import bootbox from "bootbox";

export default {
  name: "first-login-bootbox",
  initialize() {
    withPluginApi("0.8", api => {
      const user = api.getCurrentUser();
      if (!user) return;

      if (!user.read_first_notification && !user.enforcedSecondFactor) {
        const text = `Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor`;
        bootbox.alert(text);
      }
    });
  }
};

and that will give you something like this

You can use HTML in the text of the bootbox if needed. Once the user dismisses the bootbox and clicks on the circled avatar, they’ll never see the bootbox again.

Please note that bootboxes are meant for simple dialogs/confirmations. If you need something a little bit more complicated than that, then you’re probably better of using a modal with showModal()