Spin off data templates into file templates for Auth plugin
Change-Id: Ia70ee8f279708f41817960ea85dd3b5880ec17ae
diff --git a/lib/Kalamar/Plugin/Auth.pm b/lib/Kalamar/Plugin/Auth.pm
index 920eb46..184a028 100644
--- a/lib/Kalamar/Plugin/Auth.pm
+++ b/lib/Kalamar/Plugin/Auth.pm
@@ -29,9 +29,6 @@
sub register {
my ($plugin, $app, $param) = @_;
- # Allow data section as template resources
- push @{$app->renderer->classes}, __PACKAGE__;
-
# Load parameter from config file
if (my $config_param = $app->config('Kalamar-Auth')) {
$param = { %$param, %$config_param };
@@ -925,40 +922,9 @@
$app->log->info('Successfully registered Auth plugin');
};
+
1;
-__DATA__
-@@ partial/auth/login.html.ep
-%# # user not logged in
-% if (!stash('documentation') && !$embedded && !$c->auth->token) {
-% if (flash('handle_or_email') && !param('handle_or_email')) {
-% param(handle_or_email => flash('handle_or_email'));
-% };
- <fieldset>
- %= form_for 'login', class => 'login', begin
- <legend><span><%= loc 'login' %></span></legend>
- %= csrf_field
- %= text_field 'handle_or_email', placeholder => loc('userormail')
- %= hidden_field fwd => $c->url_with
- <div>
- %= password_field 'pwd', placeholder => loc('pwd')
- <button type="submit"><span><%= loc 'go' %></span></button>
- </div>
- % end
-
- %= content_block 'loginInfo', separator => '<hr />'
-
- </fieldset>
-% }
-
-@@ partial/auth/logout.html.ep
-% if ($c->auth->token) {
- %# TODO: CSRF protection
- <a href="<%= url_for 'logout' %>"
- class="logout"
- title="<%= loc 'logout' %>: <%= user_handle %>"><span><%= loc 'logout' %></span></a>
-% };
-
__END__
diff --git a/lib/Kalamar/Plugin/Auth/templates/partial/auth/login.html.ep b/lib/Kalamar/Plugin/Auth/templates/partial/auth/login.html.ep
new file mode 100644
index 0000000..d88bd67
--- /dev/null
+++ b/lib/Kalamar/Plugin/Auth/templates/partial/auth/login.html.ep
@@ -0,0 +1,21 @@
+%# # user not logged in
+% if (!stash('documentation') && !$embedded && !$c->auth->token) {
+% if (flash('handle_or_email') && !param('handle_or_email')) {
+% param(handle_or_email => flash('handle_or_email'));
+% };
+ <fieldset>
+ %= form_for 'login', class => 'login', begin
+ <legend><span><%= loc 'login' %></span></legend>
+ %= csrf_field
+ %= text_field 'handle_or_email', placeholder => loc('userormail')
+ %= hidden_field fwd => $c->url_with
+ <div>
+ %= password_field 'pwd', placeholder => loc('pwd')
+ <button type="submit"><span><%= loc 'go' %></span></button>
+ </div>
+ % end
+
+ %= content_block 'loginInfo', separator => '<hr />'
+
+ </fieldset>
+% }
diff --git a/lib/Kalamar/Plugin/Auth/templates/partial/auth/logout.html.ep b/lib/Kalamar/Plugin/Auth/templates/partial/auth/logout.html.ep
new file mode 100644
index 0000000..5464664
--- /dev/null
+++ b/lib/Kalamar/Plugin/Auth/templates/partial/auth/logout.html.ep
@@ -0,0 +1,6 @@
+% if ($c->auth->token) {
+ %# TODO: CSRF protection
+ <a href="<%= url_for 'logout' %>"
+ class="logout"
+ title="<%= loc 'logout' %>: <%= user_handle %>"><span><%= loc 'logout' %></span></a>
+% };