<?xml version="1.0" encoding="UTF-8"?>
<flow xmlns="http://www.springframework.org/schema/webflow"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/webflow
      http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd">

  <secured attributes="ROLE_USER, ROLE_ADMIN"/>

  <var name="account" class="org.unitedfront2.domain.Account"/>

  <view-state id="passwordForm" view="account.PasswordChangeForm" model="account">
    <binder>
      <binding property="password" required="true"/>
    </binder>
    <on-render>
      <set name="flashScope.validator" value="accountValidator"/>
    </on-render>
    <transition on="submit" to="authenticate"/>
  </view-state>

  <subflow-state id="authenticate" subflow="account.authentication-sub-flow">
    <transition on="finish" to="passwordChange"/>
  </subflow-state>

  <action-state id="passwordChange">
    <evaluate expression="accountPasswordChangeAction.changePassword"/>
    <transition on="success" to="finish"/>
  </action-state>

  <end-state id="finish" view="account.PasswordChangeSuccess"/>

</flow>
