Added:
/examples/auth/app/templates/_form_macros.html
/examples/auth/app/templates/content.html
/examples/auth/app/templates/home.html
/examples/auth/app/templates/layout.html
/examples/auth/app/templates/login.html
/examples/auth/app/templates/register.html
/examples/auth/app/templates/signup.html
=======================================
--- /dev/null
+++ /examples/auth/app/templates/_form_macros.html Tue May 10 06:44:01 2011
@@ -0,0 +1,81 @@
+{%- macro form_field_label(field) -%}
+ <label for="{{ field.id }}">{{ field.label.text }}
+ {%- if field.flags.required -%}
+ <abbr title="{{ _('This field is required.') }}">*</abbr>
+ {%- endif %}</label>
+{% endmacro %}
+
+{%- macro form_field_description(field) -%}
+ {% if field.description %}
+ <span class="descr">{{ field.description }}</span>
+ {% endif %}
+{%- endmacro -%}
+
+{%- macro form_field_errors(field) -%}
+ {% if field.errors %}
+ <ul class="errors">
+ {%- for error in field.errors -%}
+ <li>{{ error }}</li>
+ {%- endfor -%}
+ </ul>
+ {% endif %}
+{%- endmacro -%}
+
+{%- macro form_field_boolean(field) -%}
+ {{ field(**kwargs) }}
+ {{ form_field_label(field) }}
+ {{ form_field_description(field) }}
+ {{ form_field_errors(field) }}
+{%- endmacro -%}
+
+{%- macro form_field(field) -%}
+ {% if field.type == 'BooleanField' %}
+ {{ form_field_boolean(field, **kwargs) }}
+ {% else%}
+ {{ form_field_label(field) }}
+ {% if field.type == 'RadioField' %}
+ {{ field(class='radio-group', **kwargs) }}
+ {% else %}
+ {{ field(**kwargs) }}
+ {% endif %}
+ {{ form_field_description(field) }}
+ {{ form_field_errors(field) }}
+ {% endif %}
+{%- endmacro -%}
+
+{%- macro form_field_td(field) -%}
+ {% if field.type == 'BooleanField' %}
+ <td class="label"></td>
+ <td class="field">
+ {{ form_field_boolean(field, **kwargs) }}
+ </td>
+ {% else %}
+ <td class="label">
+ {{ form_field_label(field) }}
+ </td>
+ <td class="field">
+ {% if field.type == 'RadioField' %}
+ {{ field(class='radio-group', **kwargs) }}
+ {% else %}
+ {{ field(**kwargs) }}
+ {% endif %}
+ {{ form_field_description(field) }}
+ {{ form_field_errors(field) }}
+ </td>
+ {% endif %}
+{%- endmacro -%}
+
+{%- macro form_fields(fields) -%}
+ {% for field in fields %}
+ {% if field.type == 'HiddenField' %}
+ {{ field() }}
+ {% endif %}
+ {% endfor %}
+ <ol>
+ {% for field in fields %}
+ {% if field.type != 'HiddenField' %}
+ <li>{{ form_field(field) }}</li>
+ {% endif %}
+ {% endfor %}
+ </ol>
+{%- endmacro -%}
=======================================
--- /dev/null
+++ /examples/auth/app/templates/content.html Tue May 10 06:44:01 2011
@@ -0,0 +1,6 @@
+{% extends 'layout.html' %}
+
+{% block body %}
+ <p>This content is only accessible by logged in users with accounts
saved in datastore.</p>
+{% endblock %}
+
=======================================
--- /dev/null
+++ /examples/auth/app/templates/home.html Tue May 10 06:44:01 2011
@@ -0,0 +1,9 @@
+{% extends 'layout.html' %}
+
+{% block body %}
+ <p>This is a <a href="http://www.tipfy.org/">tipfy</a> example for
+ authentication using multi-auth users system.</p>
+
+ <p>Users are required to save an account record to access <a href="{{
url_for('content/index') }}">protected content</a>.</p>
+{% endblock %}
+
=======================================
--- /dev/null
+++ /examples/auth/app/templates/layout.html Tue May 10 06:44:01 2011
@@ -0,0 +1,59 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML
4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>Tipfy Auth Example</title>
+ <link rel="stylesheet" type="text/css"
href="/static/styles/screen.css">
+ </head>
+ <body>
+ <div class="yui-d1">
+ <div class="top">
+ <h1>tipfy.ext.auth example</h1>
+ <div class="user-status">
+ <p>{% if current_user or auth_session -%}
+ {% if current_user -%}
+ Signed in as <span class="user_email">{{
current_user.username|e }}</span> |
+ {%- endif %} <a href="{{ logout_url }}">Sign
out</a>
+ {% else %}
+ Hi, there. <a href="{{ login_url }}">Sign in</a>
+ {% endif %}</p>
+ </div>
+ </div>
+ </div>
+ <div class="yui-d1">
+ <div class="yui-t2">
+ <div class="yui-main">
+ <div class="yui-b">
+ <div class="content">
+ {% block body %}
+ {% endblock %}
+ </div>
+
+ <div class="footer">
+ <p>Powered by <a
href="http://www.tipfy.org/">tipfy</a>. Source code is <a
href="http://code.google.com/p/tipfy-ext-auth/source/browse/#hg/examples/multi-auth">here</a>.
Icons by <a
href="http://jwloh.deviantart.com/art/Aquaticus-Social-91014249">jwloh</a>.</p>
+ </div>
+ </div>
+ </div>
+ <div class="yui-b">
+ <ul class="menu">
+ <li{% if section == 'home' %} class="active"{%
endif %}><a href="{{ url_for('home') }}">Home</a></li>
+ <li{% if section == 'content' %} class="active"{%
endif %}><a href="{{ url_for('content/index') }}">Protected Content</a></li>
+ </ul>
+ </div>
+ </div>
+ </div>
+
+ {%- block body_extra %}
+ <script src="/static/scripts/scripts.js"></script>
+
+ {%- block messages -%}
+ <script>
+ tipfy.instances = {};
+ tipfy.instances.messages = new
tipfy.ui.Messages('tipfy-messages');
+ {% if messages %}
+ tipfy.instances.messages.addMessages({{ messages }});
+ {% endif %}
+ </script>
+ {%- endblock -%}
+ {% endblock %}
+ </body>
+</html>
=======================================
--- /dev/null
+++ /examples/auth/app/templates/login.html Tue May 10 06:44:01 2011
@@ -0,0 +1,29 @@
+{% extends 'layout.html' %}
+
+{% from '_form_macros.html' import form_field %}
+
+{% block body %}
+ <h1>Sign in</h1>
+ <form method="post" action="{{ current_url }}"
enctype="multipart/form-data" class="tipfy-form">
+ <ol>
+ <li>{{ form_field(form.username, class='medium') }}</li>
+ <li>{{ form_field(form.password, class='medium') }}</li>
+ <li>{{ form_field(form.remember) }}</li>
+ </ol>
+ <fieldset class="submit">
+ <input type="submit" name="submit" value="{{ _('Sign in') }}">
+ </fieldset>
+ </form>
+
+ <p>Don't have an account? <a href="{{ url_for('auth/register')
}}">Create a new one</a>.</p>
+
+ <p>Or select a service to sign in with:</p>
+ <p>
+ <a href="{{ facebook_login_url }}" title="Sign in with
Facebook"><img src="/static/images/facebook.png" width="60" height="60"
alt="Sign in with Facebook"></a>
+ <a href="{{ friendfeed_login_url }}" title="Sign in with
FriendFeed"><img src="/static/images/friendfeed.png" width="60" height="60"
alt="Sign in with FriendFeed"></a>
+ <a href="{{ google_login_url }}" title="Sign in with Google"><img
src="/static/images/google.png" width="60" height="60" alt="Sign in with
Google"></a>
+ <a href="{{ twitter_login_url }}" title="Sign in with
Twitter"><img src="/static/images/twitter.png" width="60" height="60"
alt="Sign in with Twitter"></a>
+ {#<a href="{{ yahoo_login_url }}" title="Sign in with Yahoo!"><img
src="/static/images/yahoo.png" width="60" height="60" alt="Sign in with
Yahoo!"></a>#}
+ </p>
+{% endblock %}
+
=======================================
--- /dev/null
+++ /examples/auth/app/templates/register.html Tue May 10 06:44:01 2011
@@ -0,0 +1,19 @@
+{% extends 'layout.html' %}
+
+{% from '_form_macros.html' import form_field %}
+
+{% block body %}
+ <h1>Register</h1>
+ <p>Fill the form to create a new account, or <a href="{{
url_for('auth/login') }}">sign in with your existing one</a>.</p>
+ <form method="post" action="{{ current_url }}"
enctype="multipart/form-data" class="tipfy-form">
+ <ol>
+ <li>{{ form_field(form.username, class='medium') }}</li>
+ <li>{{ form_field(form.password, class='medium') }}</li>
+ <li>{{ form_field(form.password_confirm, class='medium')
}}</li>
+ </ol>
+ <fieldset class="submit">
+ <input type="submit" name="submit" value="{{ _('Register') }}">
+ </fieldset>
+ </form>
+{% endblock %}
+
=======================================
--- /dev/null
+++ /examples/auth/app/templates/signup.html Tue May 10 06:44:01 2011
@@ -0,0 +1,17 @@
+{% extends 'layout.html' %}
+
+{% from '_form_macros.html' import form_field %}
+
+{% block body %}
+ <h1>Signup</h1>
+ <p>Please choose a nickname.</p>
+ <form method="post" action="{{ current_url }}"
enctype="multipart/form-data" class="tipfy-form">
+ <ol>
+ <li>{{ form_field(form.nickname, class='medium') }}</li>
+ </ol>
+ <fieldset class="submit">
+ <input type="submit" name="submit" value="{{ _('Save') }}">
+ </fieldset>
+ </form>
+{% endblock %}
+