requires 'Catalyst::Plugin::Session';
requires 'Catalyst::Plugin::Session::Store::File';
requires 'Catalyst::Plugin::Session::State::Cookie';
-requires 'CatalystX::Controller::Auth';
+requires 'CatalystX::Controller::Auth' => '0.22';
requires 'Catalyst::TraitFor::Controller::reCAPTCHA';
requires 'LWP::Protocol::https';
##
model => 'User',
login_id_field => 'username',
login_db_field => 'username',
- action_after_login => '/index',
- action_after_register => '/index',
- register_email_from => '"MyApp" <somebody@example.com>',
+ action_after_login => '/users/success',
+ action_after_register => '/users/success',
+ register_email_from => '"Stemmaweb" <stemmaweb@byzantini.st>',
register_email_subject => 'Registration to stemmaweb',
register_email_template_plain => 'register-plain.tt',
realm => 'default',
},
recaptcha => {
- pub_key => '',
- priv_key => '',
+ pub_key => '6LfR19MSAAAAACy2meHvLfZGRn3PM2rRYIAfh665',
+ priv_key => '6LfR19MSAAAAAMlQb8BdyecWNRE1bAL2YSgz2sah',
},
);
Logging in with openid/google requires two passes through the login
action, on the 2nd pass the C<openid-check> value is passed in when
the openid providing webserver links the user back to the stemmaweb
-site. This adaption to the C<login> action sets the realm we are
+site. This adaptation to the C<login> action sets the realm we are
authenticating against to be C<openid> in this case.
=cut
}
};
+=head2 success
+
+A stub page returned on login / registration success.
+
+=cut
+
+sub success :Local :Args(0) {
+ my ( $self, $c ) = @_;
+
+ $c->load_status_msgs;
+ $c->stash->{template} = 'auth/success.tt';
+}
+
+=head2 post_logout
+
+Return to the index page, not to the login page.
+
+=cut
+
+sub post_logout {
+ my( $self, $c ) = @_;
+ $c->response->redirect( $c->uri_for_action( '/index' ) );
+ $c->detach;
+}
+
=head1 AUTHOR
A clever guy
--- /dev/null
+#topbanner {
+ width: 100%;
+ height: 50px;
+ margin-top: 20px;
+}
+.error {
+ color: #d24848;
+}
background-position: bottom left;
}
+#topbanner {
+ width: 100%;
+ height: 100px;
+ margin-top: 20px;
+}
+#bannerinfo {
+ float: right;
+ margin-right: 12%;
+ margin-top: 15px;
+}
+.navlink {
+ color: #488dd2;
+ text-decoration: underline;
+}
+
+
/* Index page components */
+[% WRAPPER header.tt
+ pagetitle = "Stemmaweb - Sign in"
+ applicationstyle = c.uri_for('/css/auth.css')
+%]
+ <script type="text/javascript">
+$(document).ready(function() {
+ // call out to load the directory div
+ $('#login_actions').accordion();
+ $('.login_button').button();
+ $('#submit').button();
+
+ var status = '[% status_msg %]';
+ if( status == 'Logged in!' ) {
+ setInterval( function ( e ) {
+ window.opener.location.reload(true);
+ window.close();
+ e.preventDefault();
+ }, 2000 );
+ }
+});
+ </script>
+[% END %]
+ <div id="topbanner">
+ <h1>Stemmaweb - Sign in</h1>
+ </div>
+
+<div id="login_status">
[% IF status_msg %]
<p>[% status_msg | html %]</p>
[% END %]
[% END %]
</ul>
[% END %]
+</div>
+[% UNLESS status_msg == 'Logged in!' %]
+<div id="login_actions">
+ <h3><a href="#">Sign in with Google</a></h3>
+ <div>
+ <p>If you have a Google account, you may use it to sign into Stemmaweb.</p>
+ <form method="post" action="[% c.uri_for_action('/users/login') | html %]" autocomplete="off">
+ <input type="hidden" name="realm" value="openid"/>
+ <input type="hidden" name="openid_identifier" value="https://www.google.com/accounts/o8/id"/>
+ <input type="submit" class="login_button" id="#login_google" value="Sign in with Google"></input>
+ </form>
+ </div>
- <form method="post" action="[% c.uri_for_action('/users/login').hostless | html %]" autocomplete="off">
-
- <input type="hidden" name="realm" value="openid"/>
- <input type="hidden" name="openid_identifier" value="https://www.google.com/accounts/o8/id"/>
- <input type="submit" value="Sign in with Google"/>
-
- </form>
+ <h3><a href="#">Sign in with OpenID</a></h3>
+ <div>
+ <p>If you have an account with an <a href="http://openid.net/get-an-openid/" target="_blank">OpenID provider</a> (e.g. WordPress, Blogger, Flickr, Yahoo), you may use it to sign into Stemmaweb.
+ <form method="post" action="[% c.uri_for_action('/users/login') | html %]" autocomplete="off">
+ <input type="hidden" name="realm" value="openid"/>
+ <input type="text" name="openid_identifier"/>
+ <input type="submit" class="login_button" id="#login_openid" value="Sign in with OpenID"/>
+ </form>
+ </div>
[% UNLESS c.req.param('realm') == 'openid' %]
- <form method="post" action="[% c.uri_for_action('/users/login').hostless | html %]" autocomplete="off">
-
- <input type="hidden" name="realm" value="default"/>
-
- [% form.field('username').render %]
- [% form.field('password').render %]
- [% form.field('remember').render %]
-
- [% form.field('submit').render %]
-
- </form>
-[% END %]
\ No newline at end of file
+ <h3><a href="#">Sign in with Stemmaweb</a></h3>
+ <div>
+ <p>If you do not have Google or another OpenID account, you may <a href="[% c.uri_for_action('/users/register') | html %]">register</a> for a user account here with its own password. Once you are registered, you can use this form to sign in.</p>
+ <form id="login_local_form" method="post" action="[% c.uri_for_action('/users/login') | html %]" autocomplete="off">
+ <input type="hidden" name="realm" value="default"/>
+ [% userlabel = form.field('username').label('Email address') %]
+ [% form.field('username').render %]
+ [% form.field('password').render %]
+
+ [% rememberlabel = form.field('remember').label('Remember me') %]
+ [% form.field('remember').render %]
+
+ [% submitbutton = form.field('submit').value('Sign in with Stemmaweb') %]
+ [% form.field('submit').render %]
+ </form>
+ </div>
+[% END %]
+</div>
+[% END %]
+[% PROCESS footer.tt %]
\ No newline at end of file
+[% PROCESS header.tt
+ pagetitle = "Stemmaweb - Register"
+ applicationstyle = c.uri_for('/css/auth.css')
+%]
[% IF status_msg %]
<p>[% status_msg | html %]</p>
[% END %]
</ul>
[% END %]
- <form method="post" action="[% c.uri_for_action('/users/register').hostless | html %]" autocomplete="off">
+ <form method="post" action="[% c.uri_for_action('/users/register') | html %]" autocomplete="off">
- [% form.field('username').render %] (email)
+ [% userlabel = form.field('username').label('Email address') %]
+ [% form.field('username').render %]
[% form.field('password').render %]
[% form.field('confirm_password').render %]
[% form.field('submit').render %]
- </form>
\ No newline at end of file
+ </form>
+[% PROCESS footer.tt %]
\ No newline at end of file
--- /dev/null
+[% WRAPPER header.tt
+ pagetitle = "Stemmaweb - Logged in"
+ applicationstyle = c.uri_for('/css/auth.css')
+%]
+ <script type="text/javascript">
+$(document).ready(function() {
+ var status = '[% status_msg %]';
+ var error = '[% error_msg %]';
+ if( status && !error ) {
+ setInterval( function ( e ) {
+ window.opener.location.reload(true);
+ window.close();
+ e.preventDefault();
+ }, 2000 );
+ }
+});
+ </script>
+[% END %]
+ <div id="topbanner">
+ <h1>Stemmaweb - Signed in</h1>
+ </div>
+
+<div id="login_status">
+[% IF status_msg %]
+ <p>[% status_msg | html %]</p>
+ <p>Please wait...</p>
+[% END %]
+</div>
+[% PROCESS footer.tt %]
\ No newline at end of file
<div id="topbanner">
<h1>Stemmaweb - a collection of tools for analysis of collated texts</h1>
- <span class="mainnav">[% IF c.user_exists %]Hello! [% c.user.get_object.email %] [% ELSE %]<a href="[% c.uri_for('/login') %]">Login</a> | <a href="[% c.uri_for('/register') %]">Register</a> | [% END %]<a href="[% c.uri_for( 'about.html' ) %]">About<a> | <a href="[% c.uri_for( 'doc.html' ) %]">Help</a></span>
+ <span class="mainnav">[% IF c.user_exists %]Hello! [% c.user.get_object.email %] <a class="navlink" href="[% c.uri_for( '/logout' ) %]">Sign out</a> | [% ELSE %]<a class="navlink" onclick="window.open('[% c.uri_for( '/login' ) %]', 'loginwindow', 'height=385,width=445')">Login</a> | <a class="navlink" onclick="window.open('[% c.uri_for( '/register' ) %]', 'regwindow', 'height=385,width=445')">Register</a> | [% END %]<a class="navlink" href="[% c.uri_for( 'about.html' ) %]">About<a> </span>
</div>
<div id="directory_container">
<h2>Text directory</h2>