<!DOCTYPE html>
<html data-lt-installed="true">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body style="padding-bottom: 1px;">
    <p>Hi,</p>
    <p>I use the self post-registration feature
(<a class="moz-txt-link-freetext" href="https://docs.evolveum.com/midpoint/reference/support-4.8/misc/self-registration/">https://docs.evolveum.com/midpoint/reference/support-4.8/misc/self-registration/</a>)</p>
    <p>For this I have a simpleUserNotifier:</p>
    <p><simpleUserNotifier><br>
          <operation>add</operation><br>
          <subjectExpression><br>
              <script><br>
                  <code><br>
                      return 'Subject'<br>
                  </code><br>
              </script><br>
          </subjectExpression><br>
          <expressionFilter><br>
              <script><br>
                  <code><br>
                     
      basic.stringify(requestee?.lifecycleState).equals('proposed')<br>
                  </code><br>
              </script><br>
          </expressionFilter><br>
          <recipientExpression><br>
              <script
      xmlns:xsi=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/2001/XMLSchema-instance">"http://www.w3.org/2001/XMLSchema-instance"</a><br>
                      xsi:type="c:ScriptExpressionEvaluatorType"><br>
                  <code><br>
                      return requestee.getEmailAddress()<br>
                  </code><br>
              </script><br>
          </recipientExpression><br>
          <bodyExpression><br>
              <script
      xmlns:xsi=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/2001/XMLSchema-instance">"http://www.w3.org/2001/XMLSchema-instance"</a><br>
                      xsi:type="c:ScriptExpressionEvaluatorType"><br>
                  <code><br>
                      import
      com.evolveum.midpoint.notifications.api.events.ModelEvent<br>
      <br>
                      modelEvent = (ModelEvent) event<br>
                      newUser =
      modelEvent.getFocusContext().getObjectNew();<br>
                      userType = newUser.asObjectable();<br>
                      link = midpoint.createInvitationLink(userType);<br>
                      bodyMessage = // insert appropriate message
      containing the link<br>
                      return bodyMessage;<br>
                  </code><br>
              </script><br>
          </bodyExpression><br>
          <transport>mail</transport><br>
      </simpleUserNotifier><br>
    </p>
    <div class="moz-cite-prefix">Then I have an ObjectTemplate that
      ensures new Users are created with lifecycleState "proposed".</div>
    <div class="moz-cite-prefix">There is some additional configuration
      required, but that is the heart of it.</div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">I hope this helps.</div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">Kind regards,</div>
    <div class="moz-cite-prefix">Sven<br>
    </div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">Am 28.11.23 um 17:45 schrieb Drew
      Roberts via midPoint:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAPdfONhYkrrvDH0qV9nFMtUbtrWCf5mcT+XrBoc4khEsHC7XyA@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">What process do you guys use to prompt a newly
        created user to make a password? I've tried doing something like<br>
        <blockquote class="gmail_quote"
style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">def
          user = (event as
          ModelEvent).focusContext.objectNew?.asObjectable() as UserType<br>
          def link = midpoint.createAccountActivationLink(user)<br>
        </blockquote>
        inside a general notifier to send a mail nonce but I get a null
        token when I do that so I'm guessing I'm doing it wrong.<br
          clear="all">
        <br>
        <span class="gmail_signature_prefix">-- </span><br>
        <div dir="ltr" class="gmail_signature"
          data-smartmail="gmail_signature">
          <div dir="ltr">
            <div
style="font-family:sans-serif;font-size:12px;line-height:1.5em"><span
                style="font-weight:bold">Drew Roberts</span>  |  <span
                style="font-weight:bold">Systems Administrator II</span><br>
              IT Platform Engineering, Azusa Pacific University<br>
              <a href="https://apu.edu" target="_blank"
                moz-do-not-send="true">apu.edu</a> <br>
              <br>
              <img style="width:210px"
src="https://www.apu.edu/static/src/sites/strategic-communication-engagement/images/apu_125_logo.png"
                alt="APU logo" moz-do-not-send="true"></div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
midPoint mailing list
<a class="moz-txt-link-abbreviated" href="mailto:midPoint@lists.evolveum.com">midPoint@lists.evolveum.com</a>
<a class="moz-txt-link-freetext" href="https://lists.evolveum.com/mailman/listinfo/midpoint">https://lists.evolveum.com/mailman/listinfo/midpoint</a>
</pre>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
Sven Feyerabend
Referent für IT-Betreuung
stuvus – Studierendenvertretung Universität Stuttgart
Pfaffenwaldring 5c
70569 Stuttgart</pre>
  </body>
  <lt-container></lt-container>
</html>