# CrushTaskExample8

#### Notify users of expired password.

This task flow needs CrushFTP version 10 and an Enterprise license to be able to use the "conditional" logic with Jump and the math variable function.

**NOTE:** For Normal licenses, or single notification event for any license, there is a native feature available in User Manager for this, see [advanced notification of expiration](Advanced-notification-of-expiration.md)

You need to create a new job in the jobs, tab.

<img src="CrushTaskExample8/expire_pass_overall.jpg" width="1080" alt="Expire pass overall">

**Step1:** is for reusability of the Job, we define a custom variable to set the number of days\
after which the notifications are triggered for a certain user. Referred to below as **X** days

<img src="CrushTaskExample8/expire_pass_uservar.jpg" width="800" alt="Expire pass uservar">

**Step2:** is to read and create the UserList of the users or groups we work with.

<img src="CrushTaskExample8/expire_pass_userlist.jpg" width="800" alt="Expire pass userlist">

So we first link a variable from the user object loaded in **Step2**, and parse out its date format.&nbsp;&nbsp;Then we do a comparison with that value, versus the current date, minus **X** days worth.&nbsp;&nbsp;If the expire time is sooner than X day ago, we send an email. In this task all users that have the password expiration sooner then 7 days will be notified every day for the password update.

**Step3**: We check if the user's expiration is set and defined, with a Jump task, evaluate the **expire_password_when**\
user object attribute value matches a date pattern.

```
??/??/???? ??:??:?? ??
```

<img src="CrushTaskExample8/expire_pass_jump1.jpg" width="800" alt="Expire pass jump 1">

**Step4:** Using the math function we can determine the user expiration time from the current starting time, in milliseconds:

```
    {math_start:l}{parse_start:MM/dd/yyyy HH~..~mm~..~ss aa}{expire_password_when}{parse_end}-{now}{math_end}
```

We compare this against the number of days in milliseconds, the threshold value for sending notifications.

```
    {math_start}1000*60*60*24*{notification_threshold_days}{math_end}
```

<img src="CrushTaskExample8/expire_pass_jump2.jpg" width="800" alt="Expire pass jump 2">

Step5: true, send email, false, do nothing. In the Email task **To:** field, another user attribute is referenced, the email address designated to the user account, with the **{user_email}** variable.

<img src="CrushTaskExample8/expire_pass_email.jpg" width="800" alt="Expire pass email">

---
