<?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-1.0.xsd">

  <start-state idref="init"/>

  <action-state id="init">
    <action bean="captchaAction" method="init"/>
    <transition on="success" to="isAuthenticated"/>
  </action-state>

  <decision-state id="isAuthenticated">
    <if test="${flowScope.authenticated}" then="finish" else="form"/>
  </decision-state>

  <view-state id="form" view="CaptchaForm">
    <transition on="submit" to="authenticate"/>
  </view-state>

  <action-state id="authenticate">
    <action bean="captchaAction" method="authenticate"/>
    <transition on="error" to="form"/>
    <transition on="success" to="finish"/>
  </action-state>

  <end-state id="finish"/>

</flow>
