| 1 | # OpenIDwithBanList plugin for Movable Type |
|---|
| 2 | # Author: Fumiaki Yoshimatsu (http://www.luckypines.com/mt/) |
|---|
| 3 | # Released under the Artistic License. |
|---|
| 4 | |
|---|
| 5 | package MT::Plugin::OpenIDwithBanList; |
|---|
| 6 | |
|---|
| 7 | use strict; |
|---|
| 8 | use warnings; |
|---|
| 9 | |
|---|
| 10 | use MT; |
|---|
| 11 | use base qw(MT::Plugin); |
|---|
| 12 | |
|---|
| 13 | my $plugin = MT::Plugin::OpenIDwithBanList->new({ |
|---|
| 14 | id => 'OpenIDwithBanList', |
|---|
| 15 | name => "OpenID commenter authenticator with the list of banned IdP.", |
|---|
| 16 | version => '0.1', |
|---|
| 17 | author_name => "Fumiaki Yoshimatsu", |
|---|
| 18 | author_link => "http://www.luckypines.com/mt/", |
|---|
| 19 | }); |
|---|
| 20 | MT->add_plugin($plugin); |
|---|
| 21 | |
|---|
| 22 | sub init_registry { |
|---|
| 23 | my $plugin = shift; |
|---|
| 24 | $plugin->registry({ |
|---|
| 25 | 'applications' => { |
|---|
| 26 | 'cms' => { |
|---|
| 27 | methods => { |
|---|
| 28 | 'list_idp' => '$OpenIDwithBanList::OpenID::WithBanList::list_idp', |
|---|
| 29 | 'delete_idp' => '$OpenIDwithBanList::OpenID::WithBanList::delete_idp', |
|---|
| 30 | 'add_idp' => '$OpenIDwithBanList::OpenID::WithBanList::add_idp', |
|---|
| 31 | }, |
|---|
| 32 | menus => { |
|---|
| 33 | 'manage:idp' => { |
|---|
| 34 | label => "Banned IdPs", |
|---|
| 35 | mode => "list_idp", |
|---|
| 36 | order => 1000, |
|---|
| 37 | view => "blog", |
|---|
| 38 | }, |
|---|
| 39 | } |
|---|
| 40 | } |
|---|
| 41 | }, |
|---|
| 42 | 'commenter_authenticators' => { |
|---|
| 43 | 'openid_banlist' => { |
|---|
| 44 | label => 'OpenID w/ ban list', |
|---|
| 45 | class => 'OpenID::WithBanList', |
|---|
| 46 | login_form => <<OpenID, |
|---|
| 47 | <form method="post" action="<mt:var name="script_url">"> |
|---|
| 48 | <input type="hidden" name="__mode" value="login_external" /> |
|---|
| 49 | <input type="hidden" name="blog_id" value="<mt:var name="blog_id">" /> |
|---|
| 50 | <input type="hidden" name="entry_id" value="<mt:var name="entry_id">" /> |
|---|
| 51 | <input type="hidden" name="static" value="<mt:var name="static" escape="html">" /> |
|---|
| 52 | <fieldset> |
|---|
| 53 | <mtapp:setting |
|---|
| 54 | id="openid_display" |
|---|
| 55 | label="<__trans phrase="OpenID URL">" |
|---|
| 56 | hint="<__trans phrase="Sign in using your OpenID identity.">"> |
|---|
| 57 | <input type="hidden" name="key" value="openid_banlist" /> |
|---|
| 58 | <input name="openid_url" style="background: #fff url('<mt:var name="static_uri">images/comment/openid_logo.png') no-repeat left; padding-left: 18px; padding-bottom: 1px; border: 1px solid #5694b6; width: 304px; font-size: 110%;" /> |
|---|
| 59 | <p class="hint"><__trans phrase="OpenID is an open and decentralized single sign-on identity system."></p> |
|---|
| 60 | </mtapp:setting> |
|---|
| 61 | |
|---|
| 62 | <div class="pkg"> |
|---|
| 63 | <div class="left"><input type="submit" name="submit" value="<__trans phrase="Sign In">" /></div> |
|---|
| 64 | <div class="right"><img src="<mt:var name="static_uri">images/comment/openid_enabled.png" /></div> |
|---|
| 65 | </div> |
|---|
| 66 | <p><img src="<mt:var name="static_uri">images/comment/blue_moreinfo.png"> <a href="http://www.openid.net/"><__trans phrase="Learn more about OpenID."></a></p> |
|---|
| 67 | </fieldset> |
|---|
| 68 | </form> |
|---|
| 69 | OpenID |
|---|
| 70 | login_form_params => \&MT::_commenter_auth_params, |
|---|
| 71 | condition => \&MT::_openid_commenter_condition, |
|---|
| 72 | logo => 'images/comment/signin_openid.png', |
|---|
| 73 | logo_small => 'images/comment/openid_logo.png', |
|---|
| 74 | }, |
|---|
| 75 | }, |
|---|
| 76 | }); |
|---|
| 77 | } |
|---|
| 78 | |
|---|
| 79 | sub instance { $plugin } |
|---|
| 80 | |
|---|
| 81 | 1; |
|---|
| 82 | |
|---|