Send initial password to users

Adaxes can send email or SMS notifications after any operation in a managed domain, if the operation was perfomed via Adaxes. For example, you can configure Adaxes to send a notification based on a template every time a new user is created. This template can be customized to contain information about the created user, for example, their username and initial password.

In this tutorial, you will learn how to send the username and the initial password of a new account to the user and their manager.

To be able to send email and SMS messages, you need to configure mail and SMS settings in Adaxes.

 How to configure SMS settings {id=configure_sms}

Adaxes can deliver SMS messages through any SMS gateway service that supports SMTP and HTTP/S delivery. You need to have either an internal SMS gateway service or subscribe to an external provider that supports the Email to SMS or HTTP/S to SMS (REST API) feature. To configure SMS settings:

  • In Adaxes Administration console, right-click your Adaxes service and click Properties.

  • Activate the SMS Settings tab and check the Enable SMS checkbox.

  • Configure the settings and click OK.

 How to configure mail settings {id=configure_sms}
  • In Adaxes Administration console, right-click your Adaxes service and click Properties.

  • Activate the Mail Settings tab and configure the settings.

To automatically perform actions after a certain operation, you need to use business rules. Adaxes provides a built-in business rule, After user creation, which is triggered after a new user is created. You can use this business rule to communicate usernames and passwords to new users.

  1. Launch Adaxes Administration console.

     How {id=collapse1}
    • On the computer where Adaxes Administration console is installed, open Windows Start menu.

    • Click Adaxes Administration Console.

  2. Expand Adaxes service \ Configuration \ Business Rules \ Builtin and select After user creation.

    For details on how to configure and activate the business rule, see Automate user provisioning.


    Alternatively, you can create a separate business rule that will send SMS or email messages upon user account creation.

     How {id=how_to_create_business_rule}
    • In Adaxes Administration Console, right-click the Adaxes service node, select New, and then click Business Rule.

    • Enter a name for the new business rule and click Next.

    • On the Triggering Operation step, select User in the list of object types.

    • Select After and then select creating a user.

    • Click Next.

    • Click Add an action and go to step 4 of this tutorial.

  3. Click Add new action set.

    Right-click Do nothing, and then click Add Action in the context menu.

  4. Now you need to add an action that will send the password. It will be different, depending on how you want to send the password.

     SMS
    • In the Add Action dialog, select the Send SMS action.

    • Enter %mobile% into the To field to send the password to the new user. Value reference %mobile% will be replaced with the user's Mobile Phone property value.

      If you want to send the password to the user's manager, enter %adm-ManagerMobile% into the To field.

    • Enter the SMS message text into the SMS text field. For example:

      Username: %username% 
      Password: %unicodePwd%
      

      You can use other value references (e.g. %name%, %department%, %title%) in the SMS text. Before sending an SMS message, Adaxes will replace the value references with corresponding property values of the user's account. To include the user's password in the text, use %unicodePwd%.

    • When finished, click OK.

     Email
    • In the Add Action dialog, select the Send email notification action.

    • Enter %adm-ManagerEmail% into the To field. Value reference %adm-ManagerEmail% will be replaced with the value of the Email property of the new user's manager.

      If you want to email the password to the user, enter %mail% into the To field.

    • Enter the email subject into the Subject field. For example:

      New user %username% was created
      
    • Enter the email message body into the Message field. For example:

      Username: %username% 
      Password: %unicodePwd%
      

      You can use other value references (e.g. %name%, %department%, %title%) in the email subject and body. Before sending an email, Adaxes will replace the value references with corresponding property values of the user's account. To include the user's password in the body, use %unicodePwd%.

  5. Optionally, you may want the business rule to send notifications only if certain conditions are met. For example, send SMS only if a mobile phone number is specified for the user or send email only if the user's manager has an email address. To add such a condition:

    • Right-click the action, and then click Add Condition in the context menu.

    • Select the If <property> <relation> <value> condition.

    • In the Condition Parameters section, specify one of the following, depending on how your notification is sent:

      Mobile Phone - is not empty, if the notification is sent to the user via SMS.

       Screenshot{.mt-1 .mb-5}

      ManagerMobile - is not empty, if the notification is sent to the user's manager via SMS.

       Screenshot{.mt-1 .mb-5}

      Email - is not empty, if the notification is sent to the user via email.

       Screenshot{.mt-1 .mb-5}

      ManagerEmail - is not empty, if the notification is sent to the user's manager via email.

       Screenshot{.mt-1 .mb-5}

    • Click OK.

  6. Click Save changes.

Force password change

It is highly recommended to force new users to change the initial password at the first logon. To force password change, the User must change password at next logon account option must be set. You can specify the default values for user account options with the help of property patterns. For details, see Set default account options for new users.

To prevent users from changing the default account options, you can customize the form used for creating user accounts. For details, see Customize forms for user creation and editing.

Make Mobile Phone required

You can make Mobile Phone a required field with the help of property patterns. This way, you can ensure that a notificaion is sent to each new user because everyone will have a mobile phone specified. To do this:

  • Select the built-in property pattern, User.

  • In the section located to the right, click Add, and select Mobile Phone in the drop-down list.

  • Select the The property is required checkbox.

  • Click OK and then click Save changes.

For more details about making properties required, see Make a property required and specify its format .

Send messages using PowerShell scripts

It is also possible to send SMS and email messages using PowerShell scripts:

SMS

$mobilePhone = "%mobile%"
if ([System.String]::IsNullOrEmpty($mobilePhone))
{
    $Context.LogMessage("Mobile phone is not specified.", "Warning")
    return
}
$smsText = "Username: %username% Password: %unicodePwd%"
$Context.SendSms($mobilePhone, $smsText)

Email

$managerEmail = "%adm-ManagerEmail%"
if ([System.String]::IsNullOrEmpty($managerEmail))
{
    $Context.LogMessage("Manager has no email address or user has no manager.", "Warning")
    return
}
$subject = "New user %username% was created"
$textBody = "Username: %username% Password: %unicodePwd%"
$htmlBody = $null
$Context.SendMail($managerEmail, $subject, $textBody, $htmlBody)

For instructions on how to execute a PowerShell script after a user account is created via Adaxes, see Run PowerShell script after creating a user.

For information on how to create scripts for business rules, see Server-side scripting.