5. Finishing touches

The Friends database is still a little rough around the edges. There is no way to logout, for instance, and there's no indication showing whether the user is logged in or not on the main site. We'll add a logout link and then leave the rest of the polishing work as an exercise for the reader.

5.1. Logging out

The built-in authentication element we've used comes with a logout element as well. Logging out is as simple as adding the element to the site and a link to it in the template.

<element id="LOGOUT" file="rife/logout/passthrough/memory.xml" url="/logout">
  <flowlink srcexit="logged_out" destid="DISPLAY"/>

The admin menu seems like a good place for the logout link:

<p><a href="[!V 'EXIT:QUERY:logout'/]">logout</a></p>

The logout element simply resets the child trigger.

5.2. Conclusion

Now we've seen how inheritance makes it easy to add authentication to an otherwise finished application with very little intervention. This means that an application can be developed, tested and debugged without authentication, and then by just dropping in the inheritance parameter and have instant authentication support.