├── .gitignore ├── screenshot-1.png ├── screenshot-2.png ├── screenshot-3.png ├── screenshot-4.png ├── screenshot-5.png ├── browserid-logo.png ├── scripts ├── extract_po.sh ├── create_mo.sh └── merge_po.sh ├── browserid-settings.min.js ├── lib ├── browserid-constants.php ├── browserid-activation.php ├── browserid-shortcode.php ├── browserid-bbpress.php ├── browserid-widget.php ├── browserid-assertion-handler.php ├── browserid-lostpassword.php ├── browserid-admin.php ├── browserid-comments.php ├── browserid-verifier.php ├── browserid-registration.php └── browserid-login.php ├── languages ├── browserid-de_DE.po ├── browserid-sv_SE.po ├── browserid-nb_NO.po ├── browserid-nl_BE.po ├── browserid-it_IT.po ├── browserid-by_BY.po ├── browserid-ru_RU.po ├── browserid-uk_UK.po ├── browserid-es_ES.po ├── browserid-fr_CA.po ├── browserid-fr_FR.po ├── browserid-nl_NL.po └── browserid-ja_JP.po ├── CONTRIBUTING.md ├── README.md ├── browserid-settings.js ├── browserid.min.js ├── changelog ├── locale └── browserid.pot ├── browserid.min.css ├── browserid.php ├── browserid.css ├── readme.txt └── browserid.js /.gitignore: -------------------------------------------------------------------------------- 1 | .svn/ 2 | backup 3 | locale/*.po 4 | *.mo 5 | -------------------------------------------------------------------------------- /screenshot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shane-tomlinson/browserid-wordpress/master/screenshot-1.png -------------------------------------------------------------------------------- /screenshot-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shane-tomlinson/browserid-wordpress/master/screenshot-2.png -------------------------------------------------------------------------------- /screenshot-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shane-tomlinson/browserid-wordpress/master/screenshot-3.png -------------------------------------------------------------------------------- /screenshot-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shane-tomlinson/browserid-wordpress/master/screenshot-4.png -------------------------------------------------------------------------------- /screenshot-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shane-tomlinson/browserid-wordpress/master/screenshot-5.png -------------------------------------------------------------------------------- /browserid-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shane-tomlinson/browserid-wordpress/master/browserid-logo.png -------------------------------------------------------------------------------- /scripts/extract_po.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Extract strings from the browserid.php file into browserid.pot for l10n 4 | 5 | pluginroot=`dirname $0`/.. 6 | localeroot=$pluginroot/locale 7 | 8 | if [ ! -e $localeroot/browserid.pot ]; then 9 | touch $localeroot/browserid.pot 10 | fi 11 | 12 | xgettext -j -L PHP --keyword="__" --output-dir=$localeroot --output=browserid.pot --package-name="browserid-wordpress" --from-code=utf-8 $pluginroot/browserid.php 13 | 14 | -------------------------------------------------------------------------------- /scripts/create_mo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # syntax: 4 | # merge_po.sh 5 | 6 | pluginroot=`dirname $0`/.. 7 | locale_dir=$pluginroot/locale 8 | plugin_language_dir=$pluginroot/languages 9 | 10 | for lang in `find ${locale_dir} -type f -name "*.po" -not -path '*/db_LB/*'`; do 11 | dir=`dirname ${lang}` 12 | stem=`basename ${lang} .po` 13 | echo "${stem}:" 14 | pocompile -o ${plugin_language_dir}/${stem}.mo -i ${locale_dir}/${stem}.po 15 | cp ${locale_dir}/${stem}.po ${plugin_language_dir}/${stem}.po 16 | done 17 | 18 | -------------------------------------------------------------------------------- /scripts/merge_po.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # syntax: 4 | # merge_po.sh 5 | 6 | pluginroot=`dirname $0`/.. 7 | locale_dir=$pluginroot/locale 8 | plugin_language_dir=$pluginroot/languages 9 | 10 | for lang in `find $locale_dir -type f -name "*.po" -not -path '*/db_LB/*'`; do 11 | dir=`dirname $lang` 12 | stem=`basename $lang .po` 13 | echo "$stem:" 14 | msgmerge -o ${dir}/${stem}.po.tmp ${dir}/${stem}.po $plugin_language_dir/${stem}.po 15 | mv ${dir}/${stem}.po.tmp ${dir}/${stem}.po 16 | done 17 | 18 | # update any CHARSETs to UTF-8. 19 | for file in $plugin_language_dir/*.po ; do 20 | mv $file $file.old 21 | sed 's/CHARSET/UTF-8/g' $file.old > $file 22 | rm -f $file.old 23 | done 24 | 25 | -------------------------------------------------------------------------------- /browserid-settings.min.js: -------------------------------------------------------------------------------- 1 | /*jshint browser: true*//*global jQuery, wp*//* This Source Code Form is subject to the terms of the Mozilla Public 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */(function(){function c(a){if(document.location.protocol==="https://")return a;var b=document.createElement("canvas");if(!b)return a;var c=document.createElement("img");c.src=a,document.body.appendChild(c),b.width=c.width,b.height=c.height;var d=b.getContext("2d");d.drawImage(c,0,0);var e=b.toDataURL("image/png");return document.body.removeChild(c),e}"use strict";var a=jQuery;a(".js-persona__color-picker").wpColorPicker();var b={};a(".js-persona__file-picker").click(function(d){d.preventDefault();var e=a(d.target),f=e.attr("for"),g=b[f];if(g)return g.open();var h={className:"media-frame js-persona__media-frame",frame:"select",multiple:!1,title:e.attr("data-title")||"",input:a("#"+e.attr("for"))},i=e.attr("data-type");i&&(h.library={type:i}),g=b[f]=wp.media(h),g.on("select",function(){var a=g.state().get("selection").first().toJSON(),b=a.url;i==="image"&&(b=c(b)),h.input.val(b)}),g.open()})})() -------------------------------------------------------------------------------- /lib/browserid-constants.php: -------------------------------------------------------------------------------- 1 | 35 | -------------------------------------------------------------------------------- /lib/browserid-activation.php: -------------------------------------------------------------------------------- 1 | plugin_options = $options['plugin_options']; 28 | 29 | register_activation_hook($options['file'], 30 | array(&$this, 'Activate')); 31 | register_deactivation_hook($options['file'], 32 | array(&$this, 'Deactivate')); 33 | } 34 | 35 | public function Activate() { 36 | // Nothing to do must yet. 37 | } 38 | 39 | public function Deactivate() { 40 | $this->plugin_options->Deactivate(); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /lib/browserid-shortcode.php: -------------------------------------------------------------------------------- 1 | ui = $options['ui']; 27 | } 28 | 29 | public function Init() { 30 | // Shortcode 31 | add_shortcode('browserid_loginout', 32 | array(&$this, 'Shortcode_loginout')); 33 | 34 | add_shortcode('mozilla_persona', 35 | array(&$this, 'Shortcode_loginout')); 36 | } 37 | 38 | // Shortcode "mozilla_persona" 39 | public function Shortcode_loginout() { 40 | return $this->ui->Get_loginout_html(); 41 | } 42 | 43 | } 44 | } 45 | ?> 46 | -------------------------------------------------------------------------------- /languages/browserid-de_DE.po: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "" 3 | "Project-Id-Version: \n" 4 | "POT-Creation-Date: \n" 5 | "PO-Revision-Date: \n" 6 | "Last-Translator: Marcel Bokhorst\n" 7 | "Language-Team: \n" 8 | "Language: \n" 9 | "MIME-Version: 1.0\n" 10 | "Content-Type: text/plain; charset=iso-8859-1\n" 11 | "Content-Transfer-Encoding: 8bit\n" 12 | 13 | msgid "Verification void" 14 | msgstr "Überprüfung ungültig" 15 | 16 | msgid "Login failed" 17 | msgstr "Anmeldung fehlgeschlagen" 18 | 19 | msgid "Verification failed" 20 | msgstr "Überprüfung fehlgeschlagen" 21 | 22 | msgid "Verification invalid" 23 | msgstr "Überprüfung ungültig" 24 | 25 | msgid "BrowserID" 26 | msgstr "BrowserID" 27 | 28 | msgid "Administration" 29 | msgstr "Administration" 30 | 31 | msgid "Logout" 32 | msgstr "Abmelden" 33 | 34 | msgid "Custom login HTML:" 35 | msgstr "Benutzerdefiniertes Anmelde HTML:" 36 | 37 | msgid "Custom logout HTML:" 38 | msgstr "Benutzerdefiniertes Abmelde HTML:" 39 | 40 | msgid "Login redirection URL:" 41 | msgstr "Anmeldeweiterleitungs URL:" 42 | 43 | msgid "Default WordPress dashboard" 44 | msgstr "Standard WordPress Dashboard" 45 | 46 | msgid "Enable for comments:" 47 | msgstr "Für Kommentare aktivierenr:" 48 | 49 | msgid "Enable bbPress integration:" 50 | msgstr "Für bbPress aktivieren:" 51 | 52 | msgid "Enables anonymous posting implicitly" 53 | msgstr "Indirekt anonymes Kommentieren erlauben" 54 | 55 | msgid "Custom comment HTML:" 56 | msgstr "Benutzerdefiniertes Kommentar HTML:" 57 | 58 | msgid "Verification server:" 59 | msgstr "Bestätigungs Server:" 60 | 61 | msgid "Default https://verifier.login.persona.org/verify" 62 | msgstr "Standard https://verifier.login.persona.org/verify" 63 | 64 | msgid "Do not check valid until time:" 65 | msgstr "Nicht kontrollieren Ablaufzeit:" 66 | 67 | msgid "Do not verify SSL certificate:" 68 | msgstr "SSL Zertifikat nicht überprüfen:" 69 | 70 | msgid "Security risk!" 71 | msgstr "Sicherheitsrisiko!" 72 | 73 | msgid "What is BrowserID?" 74 | msgstr "Was ist BrowserID?" 75 | 76 | msgid "Debug mode:" 77 | msgstr "Debug Modus:" 78 | -------------------------------------------------------------------------------- /lib/browserid-bbpress.php: -------------------------------------------------------------------------------- 1 | is_bbpress_enabled = $options['is_bbpress_enabled']; 29 | $this->comments = $options['comments']; 30 | } 31 | 32 | public function Init() { 33 | if (! $this->is_bbpress_enabled) return; 34 | 35 | add_action('bbp_allow_anonymous', 36 | create_function('', 'return !is_user_logged_in();')); 37 | add_action('bbp_is_anonymous', 38 | create_function('', 'return !is_user_logged_in();')); 39 | add_action('bbp_theme_before_topic_form_submit_button', 40 | array(&$this, 'bbPress_submit')); 41 | add_action('bbp_theme_before_reply_form_submit_button', 42 | array(&$this, 'bbPress_submit')); 43 | 44 | } 45 | 46 | // bbPress integration 47 | public function bbPress_submit() { 48 | $id = bbp_get_topic_id(); 49 | if (empty($id)) 50 | $id = bbp_get_forum_id(); 51 | $this->comments->Comment_form_action($id); 52 | } 53 | 54 | // Imply anonymous commenting 55 | public function bbPress_anonymous() { 56 | return !is_user_logged_in(); 57 | } 58 | } 59 | } 60 | ?> 61 | -------------------------------------------------------------------------------- /languages/browserid-sv_SE.po: -------------------------------------------------------------------------------- 1 | # This file is public domain 2 | msgid "" 3 | msgstr "" 4 | "Project-Id-Version: BrowserID\n" 5 | "Report-Msgid-Bugs-To: http://wendt.se/blog/\n" 6 | "POT-Creation-Date: 2011-07-16 12:26:46+00:00\n" 7 | "PO-Revision-Date: 2012-07-27 11:56+0100\n" 8 | "Last-Translator: Marcel Bokhorst\n" 9 | "Language-Team: \n" 10 | "Language: \n" 11 | "MIME-Version: 1.0\n" 12 | "Content-Type: text/plain; charset=UTF-8\n" 13 | "Content-Transfer-Encoding: 8bit\n" 14 | "X-Poedit-Language: Swedish\n" 15 | "X-Poedit-Country: SWEDEN\n" 16 | "Plural-Forms: Plural-Forms: nplurals=2; plural=n != 1;\n" 17 | 18 | msgid "Verification void" 19 | msgstr "Verifikat saknas" 20 | 21 | msgid "Login failed" 22 | msgstr "Inloggning misslyckades" 23 | 24 | msgid "Verification failed" 25 | msgstr "Verifiering misslyckades" 26 | 27 | msgid "Verification invalid" 28 | msgstr "Verifiering ogiltig" 29 | 30 | msgid "BrowserID" 31 | msgstr "BrowserID" 32 | 33 | msgid "Administration" 34 | msgstr "Administration" 35 | 36 | msgid "Logout" 37 | msgstr "Logga ut" 38 | 39 | msgid "Custom login HTML:" 40 | msgstr "Anpassad inloggningskod (HTML):" 41 | 42 | msgid "Custom logout HTML:" 43 | msgstr "Anpassad utloggningskod (HTML):" 44 | 45 | msgid "Verification server:" 46 | msgstr "Verifieringsserver:" 47 | 48 | msgid "Default https://verifier.login.persona.org/verify" 49 | msgstr "Grundinställning: https://verifier.login.persona.org/verify" 50 | 51 | msgid "Do not check valid until time:" 52 | msgstr "Kontrollera inte giltighetstid:" 53 | 54 | msgid "Do not verify SSL certificate:" 55 | msgstr "Kontrollera inte SSL-certifikat:" 56 | 57 | msgid "Security risk!" 58 | msgstr "Säkerhetsrisk!" 59 | 60 | msgid "Debug mode:" 61 | msgstr "Felavsökningsläge:" 62 | 63 | msgid "Login redirection URL:" 64 | msgstr "Omdirigerings-URL vid inloggning:" 65 | 66 | msgid "Default WordPress dashboard" 67 | msgstr "WordPress kontrollpanel" 68 | 69 | msgid "What is BrowserID?" 70 | msgstr "Vad är BrowserID?" 71 | 72 | msgid "Enable for comments:" 73 | msgstr "Aktivera för kommentarer:" 74 | 75 | msgid "Enable bbPress integration:" 76 | msgstr "Aktivera bbPress-integration:" 77 | 78 | msgid "Enables anonymous posting implicitly" 79 | msgstr "Aktiverar (implicit) anonyma inlägg" 80 | -------------------------------------------------------------------------------- /languages/browserid-nb_NO.po: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2010 Marcel Bokhorst 2 | # This file is distributed under the same license as the Add Link to Facebook package. 3 | msgid "" 4 | msgstr "" 5 | "Project-Id-Version: BrowserID\n" 6 | "Report-Msgid-Bugs-To: http://wordpress.org/tag/add-link-to-facebook\n" 7 | "POT-Creation-Date: 2011-07-16 12:26:46+00:00\n" 8 | "PO-Revision-Date: 2012-07-27 11:56+0100\n" 9 | "Last-Translator: Marcel Bokhorst\n" 10 | "Language-Team: Marcel Bokhorst\n" 11 | "Language: \n" 12 | "MIME-Version: 1.0\n" 13 | "Content-Type: text/plain; charset=UTF-8\n" 14 | "Content-Transfer-Encoding: 8bit\n" 15 | "X-Poedit-Language: Dutch\n" 16 | "X-Poedit-Country: BELGIUM\n" 17 | "Plural-Forms: Plural-Forms: nplurals=2; plural=n != 1;\n" 18 | 19 | msgid "Verification void" 20 | msgstr "Verifisering tom" 21 | 22 | msgid "Login failed" 23 | msgstr "Logg inn feilet" 24 | 25 | msgid "Verification failed" 26 | msgstr "Verifisering feilet" 27 | 28 | msgid "Verification invalid" 29 | msgstr "Verifisering ugyldig" 30 | 31 | msgid "BrowserID" 32 | msgstr "BrowserID" 33 | 34 | msgid "Administration" 35 | msgstr "Administrasjon" 36 | 37 | msgid "Logout" 38 | msgstr "Logg ut" 39 | 40 | msgid "Custom login HTML:" 41 | msgstr "Tilpasset logg inn HTML:" 42 | 43 | msgid "Custom logout HTML:" 44 | msgstr "Tilpasset logg ut HTML:" 45 | 46 | msgid "Verification server:" 47 | msgstr "Verifisering server:" 48 | 49 | msgid "Default https://verifier.login.persona.org/verify" 50 | msgstr "Standard https://verifier.login.persona.org/verify" 51 | 52 | msgid "Do not check valid until time:" 53 | msgstr "Ikke sjekk gyldig til tid:" 54 | 55 | msgid "Do not verify SSL certificate:" 56 | msgstr "Ikke kontroller SSL-sertifikat:" 57 | 58 | msgid "Security risk!" 59 | msgstr "Sikkerhetsrisiko!" 60 | 61 | msgid "Debug mode:" 62 | msgstr "Debug modus:" 63 | 64 | msgid "Login redirection URL:" 65 | msgstr "Logg inn omdirigering URL:" 66 | 67 | msgid "Default WordPress dashboard" 68 | msgstr "Standard WordPress kontrollpanel" 69 | 70 | msgid "What is BrowserID?" 71 | msgstr "Hva er BrowserID?" 72 | 73 | msgid "Enable for comments:" 74 | msgstr "Aktiver for kommentarer:" 75 | 76 | msgid "Enable bbPress integration:" 77 | msgstr "Aktiver bbPress integrasjon:" 78 | 79 | msgid "Enables anonymous posting implicitly" 80 | msgstr "Aktiverer anonym postering ubetinget" 81 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How to contribute 2 | 3 | Thanks for considering a contribution to the BrowserID-Wordpress plugin! This project would not be in nearly as good of shape as it is without community contributions! 4 | 5 | ## Getting Started 6 | 1. Fork the repo 7 | 2. Clone the repo locally 8 | 3. Copy the repo directory to your Wordpress installation's plugins directory 9 | 4. Activate the plugin through the Plugins menu in Wordpress 10 | 5. Have fun! 11 | 12 | ## Testing & Reporting Errors 13 | 14 | Testing and reporting errors is the easiest way to meaniningfully contribute to the BrowserID-Wordpress project. Report errors is easy, just visit the project's [issue list](https://github.com/shane-tomlinson/browserid-wordpress/issues) and click on ["New issue"](https://github.com/shane-tomlinson/browserid-wordpress/issues/new). 15 | 16 | ### Before reporting errors 17 | 18 | Before reporting a new error, search through the existing list of issues to see something similar already been reported. If it has, pile on in that issue's comments! 19 | 20 | ### What is a helpful error report? 21 | 22 | Some error reports are more useful than others. Just saying "X doesn't work" is usually not useful without context. An error report should contain as much information as possible, including plugin version, PHP version, server software, possibly a screen shot, and most importantly, an easy to follow set of Steps To Reproduce (STRs). STRs are the most reliable and fastest way of getting your bug fixed. 23 | 24 | [Issue #9](https://github.com/shane-tomlinson/browserid-wordpress/issues/9) is an example of a very useful report. The amount of text is short but it provides all the information necessary to identify and reproduce the problem. 25 | 26 | 27 | ## Making Changes to the Code 28 | 1. Fork the repo 29 | 2. Clone the repo locally 30 | 3. Copy the repo directory to your Wordpress installation's plugins directory 31 | 4. Make your changes 32 | 5. Copy your changes back to the clone 33 | 6. Commit changes to your fork 34 | 7. Push to your fork and submit a pull request 35 | 36 | 37 | ## Translations and I18n 38 | 39 | [browserid.pot](https://github.com/shane-tomlinson/browserid-wordpress/blob/master/browserid.pot) is a .POT file that contains off of the strings used in the plugin. Any of the [popular tools](http://codex.wordpress.org/Translating_WordPress#Translation_Tools) can be used to translate the strings contained in the .POT file into the language of your choice. Translated .mo files can be submitted using a pull request or by emailing them to me at [shane@shanetomlinson.com](mailto:shane@shanetomlinson.com) 40 | 41 | 42 | -------------------------------------------------------------------------------- /languages/browserid-nl_BE.po: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2010 Marcel Bokhorst 2 | # This file is distributed under the same license as the Add Link to Facebook package. 3 | msgid "" 4 | msgstr "" 5 | "Project-Id-Version: BrowserID\n" 6 | "Report-Msgid-Bugs-To: http://wordpress.org/tag/add-link-to-facebook\n" 7 | "POT-Creation-Date: 2011-07-16 12:26:46+00:00\n" 8 | "PO-Revision-Date: 2012-07-27 11:56+0100\n" 9 | "Last-Translator: Marcel Bokhorst\n" 10 | "Language-Team: Marcel Bokhorst\n" 11 | "Language: \n" 12 | "MIME-Version: 1.0\n" 13 | "Content-Type: text/plain; charset=UTF-8\n" 14 | "Content-Transfer-Encoding: 8bit\n" 15 | "X-Poedit-Language: Dutch\n" 16 | "X-Poedit-Country: BELGIUM\n" 17 | "Plural-Forms: Plural-Forms: nplurals=2; plural=n != 1;\n" 18 | 19 | msgid "Verification void" 20 | msgstr "Verificatie leeg" 21 | 22 | msgid "Login failed" 23 | msgstr "Login mislukt" 24 | 25 | msgid "Verification failed" 26 | msgstr "Verificatie mislukt" 27 | 28 | msgid "Verification invalid" 29 | msgstr "Verificatie ongeldig" 30 | 31 | msgid "BrowserID" 32 | msgstr "BrowserID" 33 | 34 | msgid "Administration" 35 | msgstr "Administratie" 36 | 37 | msgid "Logout" 38 | msgstr "Log uit" 39 | 40 | msgid "Custom login HTML:" 41 | msgstr "Maatwerk inlog HTML:" 42 | 43 | msgid "Custom logout HTML:" 44 | msgstr "Maatwerk uitlog HTML:" 45 | 46 | msgid "Login redirection URL:" 47 | msgstr "Login omleiding URL:" 48 | 49 | msgid "Default WordPress dashboard" 50 | msgstr "Standaard WordPress dashboard" 51 | 52 | msgid "Enable for comments:" 53 | msgstr "Zet aan voor commentaar:" 54 | 55 | msgid "Enable bbPress integration:" 56 | msgstr "Zet bbPress integratie aan:" 57 | 58 | msgid "Enables anonymous posting implicitly" 59 | msgstr "Zet impliciet anonieme berichten aan" 60 | 61 | msgid "Custom comment HTML:" 62 | msgstr "Maatwerk commentaar HTML:" 63 | 64 | msgid "Verification server:" 65 | msgstr "Verificatie server:" 66 | 67 | msgid "Default https://verifier.login.persona.org/verify" 68 | msgstr "Standaard https://verifier.login.persona.org/verify" 69 | 70 | msgid "Do not check valid until time:" 71 | msgstr "Controleer geldig tot tijd niet:" 72 | 73 | msgid "Do not verify SSL certificate:" 74 | msgstr "Controleer SSL certificaat niet:" 75 | 76 | msgid "Security risk!" 77 | msgstr "Veiligheidsrisico!" 78 | 79 | msgid "What is BrowserID?" 80 | msgstr "Wat is BrowserID?" 81 | 82 | msgid "Debug mode:" 83 | msgstr "Debug modus:" 84 | 85 | msgid "Site name:" 86 | msgstr "Website naam:" 87 | 88 | msgid "Site logo:" 89 | msgstr "Website logo:" 90 | 91 | msgid "Absolute path, works only with SSL" 92 | msgstr "Absoluut pad, werkt alleen met SSL" 93 | 94 | msgid "Default the WordPress site name" 95 | msgstr "Standaard de WordPress website naam" 96 | -------------------------------------------------------------------------------- /lib/browserid-widget.php: -------------------------------------------------------------------------------- 1 | 'persona__widget', 36 | 'description' => __('Mozilla Persona login button', 37 | c_bid_text_domain) 38 | ); 39 | $this->WP_Widget('MozillaPersonaLoginWidget', 'Mozilla Persona', 40 | $widget_ops); 41 | } 42 | 43 | // Widget contents 44 | function widget($args, $instance) { 45 | global $persona_plugin; 46 | extract($args); 47 | $title = apply_filters('widget_title', $instance['title']); 48 | echo $before_widget; 49 | if (!empty($title)) 50 | echo $before_title . $title . $after_title; 51 | 52 | echo ""; 53 | echo $after_widget; 54 | } 55 | 56 | // Update settings 57 | function update($new_instance, $old_instance) { 58 | $instance = $old_instance; 59 | $instance['title'] = strip_tags($new_instance['title']); 60 | return $instance; 61 | } 62 | 63 | // Render settings 64 | function form($instance) { 65 | if (empty($instance['title'])) 66 | $instance['title'] = null; 67 | ?> 68 |

69 | 70 | 71 |

72 | 78 | -------------------------------------------------------------------------------- /lib/browserid-assertion-handler.php: -------------------------------------------------------------------------------- 1 | login = $options['login']; 32 | $this->comments = $options['comments']; 33 | $this->registration = $options['registration']; 34 | $this->verifier = $options['verifier']; 35 | } 36 | 37 | public function Init() { 38 | // nothing to do. 39 | } 40 | 41 | public function Handle_assertion() { 42 | $assertion = $this->Get_assertion(); 43 | $isAssertion = !empty($assertion); 44 | 45 | if ($isAssertion) $this->Check_assertion($assertion); 46 | 47 | return $isAssertion; 48 | } 49 | 50 | // Get an assertion from that request 51 | public function Get_assertion() { 52 | // Workaround for Microsoft IIS bug 53 | if (isset($_REQUEST['?browserid_assertion'])) 54 | $_REQUEST['browserid_assertion'] = $_REQUEST['?browserid_assertion']; 55 | 56 | return isset($_REQUEST['browserid_assertion']) ? 57 | $_REQUEST['browserid_assertion'] : null; 58 | } 59 | 60 | 61 | // Check if an assertion is received. If one has been, verify it and 62 | // log the user in. If not, continue. 63 | private function Check_assertion($assertion) { 64 | $result = $this->verifier->Verify($assertion); 65 | 66 | if ($result) { 67 | $email = $result['email']; 68 | // Succeeded 69 | // XXX can we replace this with polymorphism somehow? 70 | if ($this->comments->Is_comment()) 71 | $this->comments->Handle_comment($email); 72 | else if ($this->registration->Is_registration()) 73 | $this->registration->Handle_registration($email); 74 | else 75 | $this->login->Handle_login($email); 76 | } 77 | } 78 | 79 | } 80 | } 81 | 82 | ?> 83 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Mozilla Persona (BrowserID) 2 | 3 | Implementation of Mozilla Persona (BrowserID) for WordPress 4 | 5 | ## Description 6 | 7 | [Mozilla Persona](https://login.persona.org/ "Mozilla Persona") is an open source identity system from the [Identity Team](http://identity.mozilla.com/ "Identity Team") at [Mozilla](https://mozilla.org/ "Mozilla"). 8 | 9 | "As a user of Mozilla Persona (BrowserID), you confirm your email addresses once. Then, you can sign into any web site that supports Mozilla Persona with just two clicks." 10 | 11 | This plugin allows users to sign into your site using Mozilla Persona. A widget, shortcode and template tags are provided. Custom login and logout links can be created. 12 | 13 | ### Beta features 14 | 15 | * [bbPress 2](http://bbpress.org/ "bbPress") integration: create topics / reply with Mozilla Persona 16 | 17 | ## Reporting problems 18 | 19 | Please report any issues on the plugin's [issue tracker](https://github.com/shane-tomlinson/browserid-wordpress/issues). 20 | 21 | ## Installation 22 | 23 | *Using the WordPress dashboard* 24 | 25 | 1. Login to your weblog 26 | 1. Go to Plugins 27 | 1. Select Add New 28 | 1. Search for Mozilla Persona 29 | 1. Select Install 30 | 1. Select Install Now 31 | 1. Select Activate Plugin 32 | 33 | *Manual installation* 34 | 35 | 1. Download and unzip the plugin 36 | 1. Upload the entire *browserid/* directory to the */wp-content/plugins/* directory 37 | 1. Activate the plugin through the Plugins menu in WordPress 38 | 39 | 40 | # Maintainers 41 | * [Shane Tomlinson](https://shanetomlinson.com) - shane@shanetomlinson.com or stomlinson@mozilla.com 42 | * [Marcel Bokhorst](http://blog.bokhorst.biz) 43 | 44 | 45 | 46 | ## Acknowledgments 47 | * [Marcel Bokhorst](http://blog.bokhorst.biz/) is the original author of this plugin. His awesome work has allowed me to continue. 48 | * [Guillermo Movia](mailto://deimidis@mozilla-hispano.org) for Spanish translations. 49 | * [Ruslan Bekenev - @KryDos](https://github.com/KryDos) for Russian translations, bug fixes, and continued support. 50 | * [Fabian Rodriguez - @MagicFab](https://github.com/MagicFab) for French and Canadian French translations as well as man bug reports. 51 | * [Edwin Wong @edmoz](http://www.edwinsf.com/blog/) for continued testing. 52 | * [@janw-oostendorp](https://github.com/janw-oostendorp) for updated Dutch translations and backgroundColor color picker. 53 | * [David Murdoch @davidmurdoch](https://github.com/davidmurdoch/) fixing jQuery 1.9+ compatability 54 | * [Makoto Kato @makotokato](https://github.com/makotokato) for Japanese translations. 55 | * [Jason D. Moss](https://github.com/jasondmoss) for fixing the strict errors on the admin page. 56 | * [Michael Yunat](http://getvoip.com) for Ukranian translations. 57 | 58 | This plugin uses: 59 | 60 | * The client side [Mozilla Persona script](https://login.persona.org/include.js "Mozilla Persona script") 61 | -------------------------------------------------------------------------------- /browserid-settings.js: -------------------------------------------------------------------------------- 1 | /*jshint browser: true*/ 2 | /*global jQuery, wp*/ 3 | /* This Source Code Form is subject to the terms of the Mozilla Public 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 | (function() { 7 | "use strict"; 8 | var $ = jQuery; 9 | 10 | // add color picker to the background setting 11 | $('.js-persona__color-picker').wpColorPicker(); 12 | 13 | // Add a filepicker where it is needed 14 | var mediaUploaderFrames = {}; 15 | $('.js-persona__file-picker').click(function(event) { 16 | event.preventDefault(); 17 | 18 | var target = $(event.target); 19 | var id = target.attr('for'); 20 | var mediaUploaderFrame = mediaUploaderFrames[id]; 21 | if (mediaUploaderFrame) { 22 | return mediaUploaderFrame.open(); 23 | } 24 | 25 | var mediaUploaderConfig = { 26 | className: 'media-frame js-persona__media-frame', 27 | frame: 'select', 28 | multiple: false, 29 | title: target.attr('data-title') || '', 30 | input: $('#' + target.attr('for')) 31 | }; 32 | 33 | var mediaType = target.attr('data-type'); 34 | if (mediaType) { 35 | mediaUploaderConfig.library = { 36 | type: mediaType 37 | }; 38 | } 39 | 40 | mediaUploaderFrame = mediaUploaderFrames[id] = 41 | wp.media(mediaUploaderConfig); 42 | 43 | mediaUploaderFrame.on('select', function() { 44 | var attachment = 45 | mediaUploaderFrame.state().get('selection').first().toJSON(); 46 | 47 | var url = attachment.url; 48 | if (mediaType === "image") 49 | url = getBase64ImageIfHttpSite(url); 50 | 51 | mediaUploaderConfig.input.val(url); 52 | }); 53 | 54 | mediaUploaderFrame.open(); 55 | }); 56 | 57 | function getBase64ImageIfHttpSite(imgURL) { 58 | // based on 59 | // http://stackoverflow.com/questions/5420384/convert-an-image-into-binary-data-in-javascript 60 | // Create an empty canvas element 61 | if (document.location.protocol === "https://") return imgURL; 62 | 63 | var canvas = document.createElement("canvas"); 64 | // if canvas could not be created, abort. 65 | if (!canvas) return imgURL; 66 | 67 | var img = document.createElement("img"); 68 | img.src = imgURL; 69 | document.body.appendChild(img); 70 | 71 | 72 | canvas.width = img.width; 73 | canvas.height = img.height; 74 | 75 | // Copy the image contents to the canvas 76 | var ctx = canvas.getContext("2d"); 77 | ctx.drawImage(img, 0, 0); 78 | 79 | // Get the data-URL formatted image 80 | // Firefox supports PNG and JPEG. You could check img.src to guess the 81 | // original format, but be aware the using "image/jpg" will re-encode the image. 82 | var dataURL = canvas.toDataURL("image/png"); 83 | 84 | document.body.removeChild(img); 85 | 86 | return dataURL; 87 | } 88 | }()); 89 | 90 | -------------------------------------------------------------------------------- /lib/browserid-lostpassword.php: -------------------------------------------------------------------------------- 1 | browserid_only_auth = $options['browserid_only_auth']; 29 | $this->ui = $options['ui']; 30 | } 31 | 32 | public function Init() { 33 | if (! $this->browserid_only_auth) return; 34 | 35 | add_action('lost_password', 36 | array(&$this, 'Disallow_lost_password')); 37 | add_filter('allow_password_reset', 38 | array(&$this, 'Disallow_password_reset')); 39 | add_filter('show_password_fields', 40 | array(&$this, 'Hide_password_fields')); 41 | add_filter('gettext', 42 | array(&$this, 'Hide_lost_password_text')); 43 | } 44 | 45 | // If only BrowserID logins are allowed, a reset password form should 46 | // not be shown. 47 | public function Disallow_lost_password() { 48 | // The blogname option is escaped with esc_html on the way into the database in sanitize_option 49 | // we want to reverse this for the plain text arena of emails. 50 | $blogname = wp_specialchars_decode( 51 | get_option('blogname'), ENT_QUOTES); 52 | login_header(__('Password reset disabled', c_bid_text_domain), 53 | '

' . sprintf(__('%s uses Mozilla Persona to sign in and does not use passwords. Password reset is disabled.', c_bid_text_domain), $blogname) . "

"); 54 | login_footer('user_login'); 55 | exit(); 56 | } 57 | 58 | // Disable reset password if in BrowserID only mode 59 | public function Disallow_password_reset() { 60 | return false; 61 | } 62 | 63 | // Disable change password form if in BrowserID only mode 64 | public function Hide_password_fields() { 65 | return false; 66 | } 67 | 68 | // In Disable Non-Persona auth mode, Hide the "Lost your password?" 69 | // link from the login page by not giving it any text. If the user 70 | // still lands on the reset password page, a nice error screen is 71 | // shown saying "no way, Jose." 72 | public function Hide_lost_password_text($text) { 73 | if ($text == 'Lost your password?') { 74 | $text = ''; 75 | } 76 | 77 | return $text; 78 | } 79 | 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /languages/browserid-it_IT.po: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "" 3 | "Project-Id-Version: \n" 4 | "Report-Msgid-Bugs-To: \n" 5 | "POT-Creation-Date: 2012-07-20 19:19+0100\n" 6 | "PO-Revision-Date: \n" 7 | "Last-Translator: Marcel Bokhorst\n" 8 | "Language-Team: \n" 9 | "Language: \n" 10 | "MIME-Version: 1.0\n" 11 | "Content-Type: text/plain; charset=UTF-8\n" 12 | "Content-Transfer-Encoding: 8bit\n" 13 | "X-Poedit-KeywordsList: _e;__\n" 14 | "X-Poedit-Basepath: .\n" 15 | "X-Poedit-SearchPath-0: .\n" 16 | 17 | #: browserid.php:92 18 | msgid "Logout" 19 | msgstr "Disconnettiti" 20 | 21 | #: browserid.php:121 browserid.php:243 browserid.php:429 22 | msgid "Verification failed" 23 | msgstr "Convalida fallita" 24 | 25 | #: browserid.php:204 26 | msgid "Verification void" 27 | msgstr "Convalida nulla" 28 | 29 | #: browserid.php:229 30 | msgid "Verification invalid" 31 | msgstr "Convalida non valida" 32 | 33 | #: browserid.php:302 34 | msgid "Login failed" 35 | msgstr "Errore di connessione" 36 | 37 | #: browserid.php:476 38 | msgid "What is Persona?" 39 | msgstr "Che cos'è Persona?" 40 | 41 | #: browserid.php:504 browserid.php:505 browserid.php:639 42 | msgid "Mozilla Persona" 43 | msgstr "Mozilla Persona" 44 | 45 | #: browserid.php:504 46 | msgid "Administration" 47 | msgstr "Amministrazione" 48 | 49 | #: browserid.php:515 50 | msgid "Site name:" 51 | msgstr "Nome del sito:" 52 | 53 | #: browserid.php:516 54 | msgid "Site logo:" 55 | msgstr "Logo del sito:" 56 | 57 | #: browserid.php:517 58 | msgid "Custom login HTML:" 59 | msgstr "HTML personalizzato per la connessione:" 60 | 61 | #: browserid.php:518 62 | msgid "Custom logout HTML:" 63 | msgstr "HTML personalizzato per la disconnessione:" 64 | 65 | #: browserid.php:519 66 | msgid "Login redirection URL:" 67 | msgstr "URL di reindirizzamento dopo la connessione:" 68 | 69 | #: browserid.php:520 70 | msgid "Enable for comments:" 71 | msgstr "Attiva per i commenti:" 72 | 73 | #: browserid.php:521 74 | msgid "Enable bbPress integration:" 75 | msgstr "Attiva l'integrazione bbPress" 76 | 77 | #: browserid.php:522 78 | msgid "Custom comment HTML:" 79 | msgstr "HTML personalizzato per i commenti:" 80 | 81 | #: browserid.php:523 82 | msgid "Verification server:" 83 | msgstr "Server di convalida:" 84 | 85 | #: browserid.php:524 86 | msgid "Do not check valid until time:" 87 | msgstr "Non controllare la scadenza di validità:" 88 | 89 | #: browserid.php:525 90 | msgid "Do not verify SSL certificate:" 91 | msgstr "Non controllare il certificato SSL:" 92 | 93 | #: browserid.php:526 94 | msgid "Debug mode:" 95 | msgstr "Modalità di debug:" 96 | 97 | #: browserid.php:540 98 | msgid "Default the WordPress site name" 99 | msgstr "Predefinito Nome del sito di Wordpress" 100 | 101 | #: browserid.php:549 102 | msgid "Absolute path, works only with SSL" 103 | msgstr "Percorso assoluto, necessario per SSL" 104 | 105 | #: browserid.php:574 106 | msgid "Default WordPress dashboard" 107 | msgstr "Predefinito Bacheca Wordpress" 108 | 109 | #: browserid.php:591 110 | msgid "Enables anonymous posting implicitly" 111 | msgstr "Attiva implicitamente i commenti anonimi" 112 | 113 | #: browserid.php:608 114 | msgid "Default https://verifier.login.persona.org/verify" 115 | msgstr "Predefinito https://verifier.login.persona.org/verify" 116 | 117 | #: browserid.php:616 browserid.php:624 browserid.php:632 118 | msgid "Security risk!" 119 | msgstr "Rischio di sicurezza!" 120 | 121 | #: browserid.php:644 122 | msgid "Save Changes" 123 | msgstr "Salva le Modifiche" 124 | 125 | #: browserid.php:722 126 | msgid "Mozilla Persona login button" 127 | msgstr "Pulsante di accesso di Mozilla Persona" 128 | 129 | #: browserid.php:745 130 | msgid "Title:" 131 | msgstr "Titolo:" 132 | 133 | msgid "BrowserID" 134 | msgstr "Persona" 135 | -------------------------------------------------------------------------------- /lib/browserid-admin.php: -------------------------------------------------------------------------------- 1 | browserid_only_auth = $options['browserid_only_auth']; 33 | $this->logged_in_user = $options['logged_in_user']; 34 | $this->ui = $options['ui']; 35 | $this->is_debug = $options['is_debug']; 36 | $this->audience = $options['audience']; 37 | $this->logout_html = $options['logout_html']; 38 | } 39 | 40 | public function Init() { 41 | if (is_admin()) { 42 | add_filter('plugin_action_links', 43 | array(&$this, 'Add_settings_link_filter'), 10, 2); 44 | 45 | if ($this->browserid_only_auth) { 46 | // XXX this could equally go in browserid-registration 47 | add_action('admin_action_createuser', 48 | array(&$this, 'Set_new_user_password_action')); 49 | } 50 | } 51 | 52 | add_action('admin_bar_menu', 53 | array(&$this, 'Admin_toolbar_replace_logout_action'), 999); 54 | } 55 | 56 | // Add a "Settings" link to the plugin list page. 57 | public function Add_settings_link_filter($links, $file) { 58 | static $this_plugin; 59 | 60 | if (!$this_plugin) { 61 | // XXX fix this logic to find the plugin's root filename 62 | $this_plugin = plugin_basename(__FILE__); 63 | } 64 | 65 | if ($file == $this_plugin) { 66 | // The "page" query string value must be equal to the slug 67 | // of the Settings admin page we defined earlier, which in 68 | // this case equals "myplugin-settings". 69 | $settings_link = '' 72 | . __('Settings', c_bid_text_domain) . ''; 73 | array_unshift($links, $settings_link); 74 | } 75 | 76 | return $links; 77 | } 78 | 79 | 80 | // set a fake password when creating a password for a user. 81 | // only called if "BrowserID Only" auth is set. 82 | public function Set_new_user_password_action() { 83 | if (! (isset( $_POST['pass1']) && isset( $_POST['pass2']))) { 84 | $user_pass = wp_generate_password( 12, false); 85 | $_POST['pass1'] = $user_pass; 86 | $_POST['pass2'] = $user_pass; 87 | } 88 | } 89 | 90 | public function Admin_toolbar_replace_logout_action($wp_toolbar) { 91 | // If the user is signed in via Persona, replace their toolbar logout 92 | // with a logout that will work with Persona. 93 | if ( $this->logged_in_user ) { 94 | $wp_toolbar->remove_node('logout'); 95 | $wp_toolbar->add_node(array( 96 | 'id' => 'logout', 97 | 'title' => $this->logout_html, 98 | 'parent' => 'user-actions', 99 | 'href' => wp_logout_url(), 100 | 'meta' => array( 101 | 'class' => 'js-persona__logout' 102 | ) 103 | )); 104 | } 105 | } 106 | 107 | } 108 | } 109 | ?> 110 | -------------------------------------------------------------------------------- /lib/browserid-comments.php: -------------------------------------------------------------------------------- 1 | is_comments_enabled = $options['is_comments_enabled']; 30 | $this->is_bbpress_enabled = $options['is_bbpress_enabled']; 31 | $this->ui = $options['ui']; 32 | $this->button_html = $options['button_html']; 33 | } 34 | 35 | public function Init() { 36 | if (! $this->is_comments_enabled) return; 37 | 38 | add_filter('comment_form_default_fields', 39 | array(&$this, 'Remove_email_field_filter')); 40 | add_action('comment_form', 41 | array(&$this, 'Add_persona_to_comment_form_action')); 42 | add_filter('pre_comment_approved', 43 | array(&$this, 'Only_allow_comments_with_assertions_filter'), 20, 2); 44 | } 45 | 46 | public function Is_comment() { 47 | if ($this->is_comments_enabled || $this->enabled_for_bbpress) 48 | return (isset($_REQUEST['browserid_comment']) ? $_REQUEST['browserid_comment'] : null); 49 | 50 | return null; 51 | } 52 | 53 | // Process comment 54 | public function Handle_comment($email) { 55 | // Initialize 56 | $author = $_REQUEST['author']; 57 | $url = $_REQUEST['url']; 58 | 59 | // Check WordPress user 60 | $userdata = get_user_by('email', $email); 61 | if ($userdata) { 62 | $author = $userdata->display_name; 63 | $url = $userdata->user_url; 64 | } 65 | else if (empty($author) || empty($url)) { 66 | // Check Gravatar profile 67 | $response = wp_remote_get('http://www.gravatar.com/' . md5($email) . '.json'); 68 | if (!is_wp_error($response)) { 69 | $json = json_decode($response['body']); 70 | if (empty($author)) 71 | $author = $json->entry[0]->displayName; 72 | } 73 | } 74 | 75 | if (empty($author)) { 76 | // Use first part of e-mail 77 | $parts = explode('@', $email); 78 | $author = $parts[0]; 79 | } 80 | 81 | 82 | // Update post variables 83 | $_POST['author'] = $author; 84 | $_POST['email'] = $email; 85 | $_POST['url'] = $url; 86 | // bbPress 87 | $_POST['bbp_anonymous_name'] = $author; 88 | $_POST['bbp_anonymous_email'] = $email; 89 | $_POST['bbp_anonymous_website'] = $url; 90 | } 91 | 92 | 93 | public function Remove_email_field_filter($fields) { 94 | unset($fields['email']); 95 | return $fields; 96 | } 97 | 98 | public function Add_persona_to_comment_form_action($post_id) { 99 | if (!is_user_logged_in()) { 100 | $this->ui->Print_persona_button_html( 101 | "js-persona__submit-comment", $this->button_html); 102 | } 103 | 104 | // Display error message 105 | // XXX can this be taken care of in browserid.php somehow? 106 | if (isset($_REQUEST['browserid_error'])) { 107 | $this->ui->Print_persona_error( 108 | $_REQUEST['browserid_error'], 'persona__error-comment'); 109 | } 110 | } 111 | 112 | public function Only_allow_comments_with_assertions_filter($approved, $commentdata) { 113 | // If user is logged in, they can submit a comment. 114 | if (is_user_logged_in()) return; 115 | 116 | $assertion = $this->ui->Get_assertion(); 117 | if (empty($assertion)) { 118 | if ( defined('DOING_AJAX') ) 119 | die(__('Comment must be submitted using Persona')); 120 | 121 | wp_die(__('Comment must be submitted using Persona')); 122 | } 123 | } 124 | } 125 | 126 | } 127 | -------------------------------------------------------------------------------- /lib/browserid-verifier.php: -------------------------------------------------------------------------------- 1 | ui = $options['ui']; 32 | 33 | $this->vserver = $options['vserver']; 34 | $this->audience = $options['audience']; 35 | 36 | $this->is_debug = $options['is_debug']; 37 | $this->rememberme = $options['rememberme']; 38 | } 39 | 40 | public function Init() { 41 | add_action('http_api_curl', array(&$this, 'http_api_curl')); 42 | } 43 | 44 | public function http_api_curl($handle) { 45 | // When making the request to the verifier, use the local 46 | // cacert.pem which has the root cert for the Persona verifier. 47 | curl_setopt($handle, CURLOPT_CAINFO, dirname(__FILE__) . '/../cacert.pem'); 48 | } 49 | 50 | public function Get_verification_failed_message() { 51 | return __('Verification failed', c_bid_text_domain); 52 | } 53 | 54 | // Post the assertion to the verifier. If the assertion does not 55 | // verify, an error message will be displayed and no more processing 56 | // will occur 57 | public function Verify($assertion) { 58 | $response = $this->Send_assertion_to_verifier($assertion); 59 | $result = $this->Check_response($response); 60 | 61 | $this->Persist_debug_info($result); 62 | 63 | if (is_wp_error($result)) { 64 | $this->Handle_response_errors($result); 65 | } 66 | 67 | return $result; 68 | } 69 | 70 | private function Send_assertion_to_verifier($assertion) { 71 | // Build arguments 72 | $args = array( 73 | 'method' => 'POST', 74 | 'timeout' => 30, 75 | 'redirection' => 0, 76 | 'httpversion' => '1.0', 77 | 'blocking' => true, 78 | 'headers' => array(), 79 | 'body' => array( 80 | 'assertion' => $assertion, 81 | 'audience' => $this->audience 82 | ), 83 | 'cookies' => array(), 84 | 'sslverify' => true 85 | ); 86 | 87 | // Verify assertion 88 | $response = wp_remote_post($this->vserver, $args); 89 | 90 | if (is_wp_error($response)) { 91 | $this->Handle_response_errors($response); 92 | } 93 | 94 | return $response; 95 | } 96 | 97 | private function Check_response($response) { 98 | $result = json_decode($response['body'], true); 99 | 100 | if (empty($result) || empty($result['status'])) { 101 | return new WP_Error('verification_response_invalid', 102 | __('Verification response invalid', c_bid_text_domain)); 103 | } 104 | else if ($result['status'] != 'okay') { 105 | $message = __('Verification failed', c_bid_text_domain); 106 | if (isset($result['reason'])) 107 | $message .= ': ' . __($result['reason'], c_bid_text_domain); 108 | 109 | return new WP_Error('verification_failed', $message); 110 | } 111 | 112 | // Success! 113 | return $result; 114 | } 115 | 116 | private function Persist_debug_info($response) { 117 | if ($this->is_debug) { 118 | $response['vserver'] = $this->vserver; 119 | $response['audience'] = $this->audience; 120 | $response['rememberme'] = $this->rememberme; 121 | update_option(c_bid_option_response, $response); 122 | } 123 | } 124 | 125 | // Check response. If response is either invalid or indicates a bad 126 | // assertion, an error message will be printed and processing 127 | // will stop. If verification succeeds, response will be returned. 128 | private function Handle_response_errors($response) { 129 | $message = __($response->get_error_message()); 130 | $this->ui->Handle_error($message, $message, $response); 131 | } 132 | } 133 | } 134 | ?> 135 | -------------------------------------------------------------------------------- /browserid.min.js: -------------------------------------------------------------------------------- 1 | /*jshint browser: true*//*global browserid_common, jQuery*/(function(){"use strict";function a(e){return e||"login"}function f(e){t=e;var n={siteName:browserid_common.siteName||"",siteLogo:browserid_common.siteLogo||"",backgroundColor:browserid_common.backgroundColor||"",termsOfService:browserid_common.termsOfService||"",privacyPolicy:browserid_common.privacyPolicy||""};t==="comment"?n.returnTo=w("#submit_comment"):t==="register"&&(n.returnTo=w("#submit_registration")),navigator.id.request(n)}function l(t){var n=document.getElementById("rememberme");n!==null&&(n=n.checked);var r=document.createElement("form");r.setAttribute("style","display: none;"),r.method="POST",r.action=browserid_common.urlLoginSubmit;var i={browserid_assertion:t,rememberme:n};browserid_common.urlLoginRedirect!==null&&(i.redirect_to=browserid_common.urlLoginRedirect),E(r,i),e("body").append(r),r.submit()}function c(){r=!0,p(),f("comment")}function h(t){var i=d();if(!i&&!n)return v();var o=e("#commentform"),u=e("#comment_post_ID").val();E(o,{browserid_comment:u,browserid_assertion:t}),localStorage.removeItem("comment_hash"),sessionStorage.setItem("submitting_comment","true"),browserid_common.loggedInUser||(r=!0,navigator.id.logout()),s=!0,e("#submit").click()}function p(){var t={author:e("#author").val(),url:e("#url").val(),comment:e("#comment").val(),comment_parent:e("#comment_parent").val()};localStorage.setItem("comment_state",JSON.stringify(t))}function d(){var t=localStorage.getItem("comment_state");return t&&(t=JSON.parse(t),e("#author").val(t.author),e("#url").val(t.url),e("#comment").val(t.comment),e("#comment_parent").val(t.comment_parent),localStorage.removeItem("comment_state")),t}function v(){var e=localStorage.getItem("comment_hash");e?(localStorage.removeItem("comment_hash"),document.location.hash=e,document.location.reload(!0)):setTimeout(v,100)}function m(t){var r=y();if(!r&&!n)return b();sessionStorage.setItem("submitting_registration","true"),e("#browserid_assertion").val(t),i=!0,e("#wp-submit").click()}function g(){var t={user_login:e("#user_login").val()};localStorage.setItem("registration_state",JSON.stringify(t))}function y(){var t=localStorage.getItem("registration_state");return t&&(t=JSON.parse(t),e("#user_login").val(t.user_login),localStorage.removeItem("registration_state")),t}function b(){var e=localStorage.getItem("registration_complete");e?(localStorage.removeItem("registration_complete"),document.location=browserid_common.urlRegistrationRedirect):setTimeout(b,100)}function w(e){return document.location.href.replace(/http(s)?:\/\//,"").replace(document.location.host,"").replace(/#.*$/,"")+e}function E(t,n){t=e(t);for(var r in n){var i=document.createElement("input");i.type="hidden",i.name=r,i.value=n[r],t.append(i)}}function S(){var t=e("
");e("body").append(t)}function x(t,n){function r(){var r=e(t).val();r&&r.trim().length?e(n).removeClass("disabled"):e(n).addClass("disabled")}e(n).addClass("disabled"),e(t).keyup(r),e(t).change(r)}function T(t,n,r){e("body")[typeof e.fn.on=="function"?"on":"delegate"](n,t,r)}var e=jQuery,t,n,r=!1,i=!1,s=browserid_common.loggedInUser||!1,o;e(".js-persona__login").click(function(e){e.preventDefault(),r=!1,f("login")}),T(".js-persona__logout","click",function(e){r=!1,navigator.id.logout()}),browserid_common.isPersonaUsedWithComments&&(e("body").addClass("persona--comments"),e(".js-persona__submit-comment").click(function(t){t.preventDefault(),e("#commentform").submit()}),e("#commentform").submit(function(t){if(e("#comment").hasClass("disabled")){t.preventDefault();return}s||(t.preventDefault(),c())})),browserid_common.isPersonaOnlyAuth&&(e("body").addClass("persona--persona-only-auth"),x("#user_login",".js-persona__register"),e(".js-persona__register").click(function(t){t.preventDefault();if(e(t.target).hasClass("disabled"))return;r=!1,g(),f("register")}),e("#registerform").submit(function(t){if(i)return;t.preventDefault();if(e("#user_login").val().length===0)return;r=!1,g(),f("register")}));if(document.location.hash==="#submit_comment"){r=!0,S(),o=d();if(!o)return v();t="comment",n=!0}else if(document.location.hash==="#submit_registration"){r=!0,S(),o=y();if(!o)return b();t="register",n=!0}else document.location.href===browserid_common.urlRegistrationRedirect&&sessionStorage.getItem("submitting_registration")?localStorage.setItem("registration_complete","true"):sessionStorage.getItem("submitting_comment")&&(r=!0,sessionStorage.removeItem("submitting_comment"),localStorage.setItem("comment_hash",document.location.hash));if(browserid_common.msgError||e("#login_error").length)r=!0,navigator.id.logout();var u={login:l,register:m,comment:h};navigator.id.watch({loggedInUser:browserid_common.loggedInUser||null,onlogin:function(e){t=a(t);var n=u[t];n&&n(e)},onlogout:function(){if(r)return}})})(); -------------------------------------------------------------------------------- /languages/browserid-by_BY.po: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2016 2 | # This file is distributed under the same license as the package. 3 | msgid "" 4 | msgstr "" 5 | "Project-Id-Version: \n" 6 | "Report-Msgid-Bugs-To: http://wordpress.org/tag/browserid-wordpress\n" 7 | "POT-Creation-Date: 2016-10-01 14:00:00+00:00\n" 8 | "Last-Translator: VarriableID \n" 9 | "Language-Team: http://getvoip.com/\n" 10 | "Language: uk\n" 11 | "MIME-Version: 1.0\n" 12 | "Content-Type: text/plain; charset=UTF-8\n" 13 | "Content-Transfer-Encoding: 8bit\n" 14 | "X-Generator: Poedit 1.6.5\n" 15 | 16 | #: browserid.php:131 browserid.php:909 17 | msgid "Sign in with your email" 18 | msgstr "Увайсці з сваёй паштовай скрыні" 19 | 20 | #: browserid.php:135 browserid.php:918 21 | msgid "Logout" 22 | msgstr "Выйсці" 23 | 24 | #: browserid.php:139 browserid.php:973 25 | msgid "Comment" 26 | msgstr "Каментар" 27 | 28 | #: browserid.php:164 29 | msgid "Settings" 30 | msgstr "Налады" 31 | 32 | #: browserid.php:269 browserid.php:395 33 | msgid "Verification failed" 34 | msgstr "Верыфікацыя скончылася няўдала" 35 | 36 | #: browserid.php:388 37 | msgid "Verification response invalid" 38 | msgstr "Памылковы адказ верыфікацыі" 39 | 40 | #: browserid.php:462 41 | msgid "You must already have an account to log in with Persona." 42 | msgstr "Вы павінны мець аккаўнт для ўваходу пра дапамозе Persona ." 43 | 44 | #: browserid.php:491 45 | msgid "ERROR: Your account has been marked as a spammer." 46 | msgstr "" 47 | "ПАМЫЛКА Ваш аккаўнт быў адзначаны як спаммер ." 48 | 49 | #: browserid.php:497 50 | msgid "Site Suspended." 51 | msgstr "Праца сайта спынена." 52 | 53 | #: browserid.php:594 54 | msgid "Register" 55 | msgstr "Рэгістрацыя" 56 | 57 | #: browserid.php:654 58 | msgid "Password reset disabled" 59 | msgstr "Зброс пароля адключаны" 60 | 61 | #: browserid.php:655 62 | msgid "" 63 | " %s uses Mozilla Persona to sign in and does not use passwords. Password " 64 | "reset is disabled." 65 | msgstr "" 66 | " %s выкарыстоўвае Mozilla Persona для увахода ў сістэму без пароля . " 67 | "Адноўка пароля адключана." 68 | 69 | #: browserid.php:793 70 | msgid "What is Persona?" 71 | msgstr "Што такоеPersona?" 72 | 73 | #: browserid.php:845 browserid.php:846 browserid.php:1031 74 | msgid "Mozilla Persona" 75 | msgstr "Mozilla Persona" 76 | 77 | #: browserid.php:845 78 | msgid "Administration" 79 | msgstr "Адміністрацыя" 80 | 81 | #: browserid.php:856 82 | msgid "Site name:" 83 | msgstr "Назва сайту:" 84 | 85 | #: browserid.php:857 86 | msgid "Site logo:" 87 | msgstr "Лого сайту:" 88 | 89 | #: browserid.php:858 90 | msgid "Disable non-Persona logins:" 91 | msgstr "Зрабіць Persona адзінай магчымасцю ўвахода ў сістэму:" 92 | 93 | #: browserid.php:859 94 | msgid "Login button HTML:" 95 | msgstr "HTML кнопка ўвахода:" 96 | 97 | #: browserid.php:860 98 | msgid "Logout button HTML:" 99 | msgstr "HTML кнопка выхода:" 100 | 101 | #: browserid.php:862 102 | msgid "Login redirection URL:" 103 | msgstr "URL для перанакіравання пасля входа:" 104 | 105 | #: browserid.php:863 106 | msgid "Enable for comments:" 107 | msgstr "Уключыць у камментарах:" 108 | 109 | #: browserid.php:864 110 | msgid "Enable bbPress integration:" 111 | msgstr "Уключыць інтэграцыю з bbPress:" 112 | 113 | #: browserid.php:865 114 | msgid "Comment button HTML:" 115 | msgstr "HTML кнопка камментара:" 116 | 117 | #: browserid.php:866 118 | msgid "Verification server:" 119 | msgstr "Сэрвер праверкі:" 120 | 121 | #: browserid.php:867 122 | msgid "Debug mode:" 123 | msgstr "Атладка:" 124 | 125 | #: browserid.php:901 126 | msgid "Absolute path, works only with SSL" 127 | msgstr "Абсалютны шлях, працуе толькі з SSL" 128 | 129 | #: browserid.php:928 130 | msgid "Default WordPress dashboard" 131 | msgstr "Звычайная панэль WordPress" 132 | 133 | #: browserid.php:958 134 | msgid "Enables anonymous posting implicitly" 135 | msgstr "Уключае ананімны поцінг" 136 | 137 | #: browserid.php:984 138 | msgid "Default" 139 | msgstr "Звычайныя налады" 140 | 141 | #: browserid.php:1004 142 | msgid "Security risk!" 143 | msgstr "Рызыка бяспекі!" 144 | 145 | #: browserid.php:1036 146 | msgid "Save Changes" 147 | msgstr "Захаваць налады" 148 | 149 | #: browserid.php:1109 150 | msgid "Mozilla Persona login button" 151 | msgstr "Кнопка уваходу Mozilla Persona" 152 | 153 | #: browserid.php:1140 154 | msgid "Title:" 155 | msgstr "Загаловок:" 156 | 157 | #: browserid.php:1184 158 | msgid "New user registration on your site %s:" 159 | msgstr "Новы карыстальнік зарэгистраваўся на вашым сайце %s:" 160 | 161 | #: browserid.php:1185 browserid.php:1193 162 | msgid "Username: %s" 163 | msgstr "Имя карыстальніка %s" 164 | 165 | #: browserid.php:1186 166 | msgid "E-mail: %s" 167 | msgstr "E-mail: %s" 168 | 169 | #: browserid.php:1188 170 | msgid "[%s] New User Registration" 171 | msgstr "[%s] Рэгістрацыя новага карыстальніка" 172 | 173 | #: browserid.php:1202 174 | msgid "%s uses Mozilla Persona to sign in and does not use passwords" 175 | msgstr "[%s] выкарыставаў Mozilla Persona для вўвахода без пароля" 176 | 177 | #: browserid.php:1203 178 | msgid "[%s] Your username" 179 | msgstr "[%s] Ваша імя карыстальніка" 180 | 181 | #: browserid.php:1205 182 | msgid "Password: %s" 183 | msgstr "Пароль: %s" 184 | 185 | #: browserid.php:1206 186 | msgid "[%s] Your username and password" 187 | msgstr "[%s] Ваша имя карыстальніка і пароль" 188 | -------------------------------------------------------------------------------- /changelog: -------------------------------------------------------------------------------- 1 |

0.50

2 | 5 | 6 |

0.49

7 | 10 | 11 |

0.48

12 | 15 | 16 |

0.47

17 | 20 | 21 |

0.46

22 | 33 | 34 |

0.45

35 | 49 | 50 |

0.44

51 | 67 | 68 |

0.43

69 | 76 | 77 |

0.42

78 | 81 | 82 |

0.41

83 | 86 | 87 |

0.40

88 | 100 | -------------------------------------------------------------------------------- /languages/browserid-ru_RU.po: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2013 2 | # This file is distributed under the same license as the package. 3 | msgid "" 4 | msgstr "" 5 | "Project-Id-Version: \n" 6 | "Report-Msgid-Bugs-To: http://wordpress.org/tag/browserid-wordpress\n" 7 | "POT-Creation-Date: 2013-07-04 11:02:57+00:00\n" 8 | "PO-Revision-Date: 2013-07-14 16:39+0300\n" 9 | "Last-Translator: Ruslan Bekenev (KryDos) \n" 10 | "Language-Team: LANGUAGE \n" 11 | "Language: \n" 12 | "MIME-Version: 1.0\n" 13 | "Content-Type: text/plain; charset=UTF-8\n" 14 | "Content-Transfer-Encoding: 8bit\n" 15 | "X-Generator: Poedit 1.5.4\n" 16 | 17 | #: browserid.php:131 browserid.php:909 18 | msgid "Sign in with your email" 19 | msgstr "Войти с помощью Email" 20 | 21 | #: browserid.php:135 browserid.php:918 22 | msgid "Logout" 23 | msgstr "Выход" 24 | 25 | #: browserid.php:139 browserid.php:973 26 | msgid "Comment" 27 | msgstr "Комментарий" 28 | 29 | #: browserid.php:164 30 | msgid "Settings" 31 | msgstr "Настройки" 32 | 33 | #: browserid.php:269 browserid.php:395 34 | msgid "Verification failed" 35 | msgstr "Ошибка во время проверки" 36 | 37 | #: browserid.php:388 38 | msgid "Verification response invalid" 39 | msgstr "Ответ от сервера не правильный" 40 | 41 | #: browserid.php:462 42 | msgid "You must already have an account to log in with Persona." 43 | msgstr "У вас должен быть аккаунт для входа с помощью Persona." 44 | 45 | #: browserid.php:491 46 | msgid "ERROR: Your account has been marked as a spammer." 47 | msgstr "ОШИБКА: В Вашем аккаунте замечена спам активность." 48 | 49 | #: browserid.php:497 50 | msgid "Site Suspended." 51 | msgstr "Работа сайта приостановлена." 52 | 53 | #: browserid.php:594 54 | msgid "Register" 55 | msgstr "Регистрация" 56 | 57 | #: browserid.php:654 58 | msgid "Password reset disabled" 59 | msgstr "Сброс пароля отключен" 60 | 61 | #: browserid.php:655 62 | msgid "" 63 | "%s uses Mozilla Persona to sign in and does not use passwords. Password " 64 | "reset is disabled." 65 | msgstr "" 66 | "%s использовал Mozilla Persona для входа на сайт без пароля. Сброс пароля " 67 | "отключен." 68 | 69 | #: browserid.php:793 70 | msgid "What is Persona?" 71 | msgstr "Что такое Pesona?" 72 | 73 | #: browserid.php:845 browserid.php:846 browserid.php:1031 74 | msgid "Mozilla Persona" 75 | msgstr "Mozilla Persona" 76 | 77 | #: browserid.php:845 78 | msgid "Administration" 79 | msgstr "Администрация" 80 | 81 | #: browserid.php:856 82 | msgid "Site name:" 83 | msgstr "Название сайта:" 84 | 85 | #: browserid.php:857 86 | msgid "Site logo:" 87 | msgstr "Логотип сайта:" 88 | 89 | #: browserid.php:858 90 | msgid "Disable non-Persona logins:" 91 | msgstr "Сделать Persona единственным инструментом для входа в систему:" 92 | 93 | #: browserid.php:859 94 | msgid "Login button HTML:" 95 | msgstr "HTML кнопка входа:" 96 | 97 | #: browserid.php:860 98 | msgid "Logout button HTML:" 99 | msgstr "HTML кнопка выхода:" 100 | 101 | #: browserid.php:862 102 | msgid "Login redirection URL:" 103 | msgstr "URL для перенаправления после входа:" 104 | 105 | #: browserid.php:863 106 | msgid "Enable for comments:" 107 | msgstr "Включить в комментариях:" 108 | 109 | #: browserid.php:864 110 | msgid "Enable bbPress integration:" 111 | msgstr "Включить интеграцию с bbPress:" 112 | 113 | #: browserid.php:865 114 | msgid "Comment button HTML:" 115 | msgstr "HTML кнопка комментария:" 116 | 117 | #: browserid.php:866 118 | msgid "Verification server:" 119 | msgstr "Сервер проверки:" 120 | 121 | #: browserid.php:867 122 | msgid "Debug mode:" 123 | msgstr "Режим отладки:" 124 | 125 | #: browserid.php:901 126 | msgid "Absolute path, works only with SSL" 127 | msgstr "Абсолютный путь, работает только с SSL" 128 | 129 | #: browserid.php:928 130 | msgid "Default WordPress dashboard" 131 | msgstr "Стандартная панель WordPress" 132 | 133 | #: browserid.php:958 134 | msgid "Enables anonymous posting implicitly" 135 | msgstr "Включает анонимный постинг" 136 | 137 | #: browserid.php:984 138 | msgid "Default" 139 | msgstr "По умолчанию" 140 | 141 | #: browserid.php:1004 142 | msgid "Security risk!" 143 | msgstr "Возможны проблемы с безопасностью!" 144 | 145 | #: browserid.php:1036 146 | msgid "Save Changes" 147 | msgstr "Сохранить изменения" 148 | 149 | #: browserid.php:1109 150 | msgid "Mozilla Persona login button" 151 | msgstr "Кнопка входа Mozilla Persona" 152 | 153 | #: browserid.php:1140 154 | msgid "Title:" 155 | msgstr "Заголовок:" 156 | 157 | #: browserid.php:1184 158 | msgid "New user registration on your site %s:" 159 | msgstr "Новый пользователь зарегистрировался на вашем сайте %s:" 160 | 161 | #: browserid.php:1185 browserid.php:1193 162 | msgid "Username: %s" 163 | msgstr "Имя пользователя: %s" 164 | 165 | #: browserid.php:1186 166 | msgid "E-mail: %s" 167 | msgstr "E-mail: %s" 168 | 169 | #: browserid.php:1188 170 | msgid "[%s] New User Registration" 171 | msgstr "[%s] Регистрация нового пользователя" 172 | 173 | #: browserid.php:1202 174 | msgid "%s uses Mozilla Persona to sign in and does not use passwords" 175 | msgstr "[%s] использовал Mozilla Persona для входа без пароля" 176 | 177 | #: browserid.php:1203 178 | msgid "[%s] Your username" 179 | msgstr "[%s] Ваше имя пользователя" 180 | 181 | #: browserid.php:1205 182 | msgid "Password: %s" 183 | msgstr "Пароль: %s" 184 | 185 | #: browserid.php:1206 186 | msgid "[%s] Your username and password" 187 | msgstr "[%s] Ваше имя пользователя и пароль" 188 | -------------------------------------------------------------------------------- /languages/browserid-uk_UK.po: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2013 2 | # This file is distributed under the same license as the package. 3 | msgid "" 4 | msgstr "" 5 | "Project-Id-Version: \n" 6 | "Report-Msgid-Bugs-To: http://wordpress.org/tag/browserid-wordpress\n" 7 | "POT-Creation-Date: 2013-07-04 11:02:57+00:00\n" 8 | "PO-Revision-Date: 2014-06-08 22:14+0200\n" 9 | "Last-Translator: Michael Yunat \n" 10 | "Language-Team: http://getvoip.com/\n" 11 | "Language: uk\n" 12 | "MIME-Version: 1.0\n" 13 | "Content-Type: text/plain; charset=UTF-8\n" 14 | "Content-Transfer-Encoding: 8bit\n" 15 | "X-Generator: Poedit 1.6.5\n" 16 | 17 | #: browserid.php:131 browserid.php:909 18 | msgid "Sign in with your email" 19 | msgstr "Увійти за допомогою електронної пошти" 20 | 21 | #: browserid.php:135 browserid.php:918 22 | msgid "Logout" 23 | msgstr "Вихід" 24 | 25 | #: browserid.php:139 browserid.php:973 26 | msgid "Comment" 27 | msgstr "Коментар" 28 | 29 | #: browserid.php:164 30 | msgid "Settings" 31 | msgstr "Налаштування" 32 | 33 | #: browserid.php:269 browserid.php:395 34 | msgid "Verification failed" 35 | msgstr "Перевірка завершилася невдачею" 36 | 37 | #: browserid.php:388 38 | msgid "Verification response invalid" 39 | msgstr "Перевірка невірну відповідь" 40 | 41 | #: browserid.php:462 42 | msgid "You must already have an account to log in with Persona." 43 | msgstr "Ви повинні вже є обліковий запис увійти в систему з Persona." 44 | 45 | #: browserid.php:491 46 | msgid "ERROR: Your account has been marked as a spammer." 47 | msgstr "" 48 | "ПОМИЛКА: Ваш обліковий запис була позначена як спамера." 49 | 50 | #: browserid.php:497 51 | msgid "Site Suspended." 52 | msgstr "Підвісні сайту." 53 | 54 | #: browserid.php:594 55 | msgid "Register" 56 | msgstr "Регістр" 57 | 58 | #: browserid.php:654 59 | msgid "Password reset disabled" 60 | msgstr "Відновлення пароля відключена" 61 | 62 | #: browserid.php:655 63 | msgid "" 64 | " %s uses Mozilla Persona to sign in and does not use passwords. Password " 65 | "reset is disabled." 66 | msgstr "" 67 | " %s використовує Mozilla Persona увійти в систему і не використовує паролі. " 68 | "Пароль перезавантаження відключена." 69 | 70 | #: browserid.php:793 71 | msgid "What is Persona?" 72 | msgstr "Що таке Персона?" 73 | 74 | #: browserid.php:845 browserid.php:846 browserid.php:1031 75 | msgid "Mozilla Persona" 76 | msgstr "Mozilla Persona" 77 | 78 | #: browserid.php:845 79 | msgid "Administration" 80 | msgstr "Адміністрація" 81 | 82 | #: browserid.php:856 83 | msgid "Site name:" 84 | msgstr "Назва сайту:" 85 | 86 | #: browserid.php:857 87 | msgid "Site logo:" 88 | msgstr "Лого сайту:" 89 | 90 | #: browserid.php:858 91 | msgid "Disable non-Persona logins:" 92 | msgstr "Відключення без Persona логіни:" 93 | 94 | #: browserid.php:859 95 | msgid "Login button HTML:" 96 | msgstr "Вхід кнопку HTML:" 97 | 98 | #: browserid.php:860 99 | msgid "Logout button HTML:" 100 | msgstr "Вихід кнопка HTML:" 101 | 102 | #: browserid.php:862 103 | msgid "Login redirection URL:" 104 | msgstr "Ввійти перенаправлення URL:" 105 | 106 | #: browserid.php:863 107 | msgid "Enable for comments:" 108 | msgstr "Включити в коментарях:" 109 | 110 | #: browserid.php:864 111 | msgid "Enable bbPress integration:" 112 | msgstr "Включити інтеграцію практикуючих юристів:" 113 | 114 | #: browserid.php:865 115 | msgid "Comment button HTML:" 116 | msgstr "Коментар кнопку HTML:" 117 | 118 | #: browserid.php:866 119 | msgid "Verification server:" 120 | msgstr "Перевірка сервера:" 121 | 122 | #: browserid.php:867 123 | msgid "Debug mode:" 124 | msgstr "Режим налагодження:" 125 | 126 | #: browserid.php:901 127 | msgid "Absolute path, works only with SSL" 128 | msgstr "Абсолютний шлях, працює тільки з SSL" 129 | 130 | #: browserid.php:928 131 | msgid "Default WordPress dashboard" 132 | msgstr "За замовчуванням WordPress панелі" 133 | 134 | #: browserid.php:958 135 | msgid "Enables anonymous posting implicitly" 136 | msgstr "Дозволяє анонімний неявно" 137 | 138 | #: browserid.php:984 139 | msgid "Default" 140 | msgstr "Дефолт" 141 | 142 | #: browserid.php:1004 143 | msgid "Security risk!" 144 | msgstr "Ризик безпеки!" 145 | 146 | #: browserid.php:1036 147 | msgid "Save Changes" 148 | msgstr "Зберегти зміни" 149 | 150 | #: browserid.php:1109 151 | msgid "Mozilla Persona login button" 152 | msgstr "Mozilla Persona кнопку Ввійти" 153 | 154 | #: browserid.php:1140 155 | msgid "Title:" 156 | msgstr "Назва:" 157 | 158 | #: browserid.php:1184 159 | msgid "New user registration on your site %s:" 160 | msgstr "Реєстрація нового користувача на вашому сайті %s:" 161 | 162 | #: browserid.php:1185 browserid.php:1193 163 | msgid "Username: %s" 164 | msgstr "Ім'я користувача: %s" 165 | 166 | #: browserid.php:1186 167 | msgid "E-mail: %s" 168 | msgstr "Електронна пошта: %s" 169 | 170 | #: browserid.php:1188 171 | msgid "[ %s] New User Registration" 172 | msgstr "[ %s] Реєстрація нового користувача" 173 | 174 | #: browserid.php:1202 175 | msgid " %s uses Mozilla Persona to sign in and does not use passwords" 176 | msgstr "" 177 | " %s використовує Mozilla Persona увійти в систему і не використовує паролі" 178 | 179 | #: browserid.php:1203 180 | msgid "[ %s] Your username" 181 | msgstr "[ %s] Ваше ім'я користувача" 182 | 183 | #: browserid.php:1205 184 | msgid "Password: %s" 185 | msgstr "Пароль: %s" 186 | 187 | #: browserid.php:1206 188 | msgid "[ %s] Your username and password" 189 | msgstr "[ %s] Ім'я користувача і пароль" 190 | -------------------------------------------------------------------------------- /languages/browserid-es_ES.po: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2013 2 | # This file is distributed under the same license as the package. 3 | msgid "" 4 | msgstr "" 5 | "Project-Id-Version: \n" 6 | "Report-Msgid-Bugs-To: http://wordpress.org/tag/browserid-wordpress\n" 7 | "POT-Creation-Date: 2013-07-04 11:02:57+00:00\n" 8 | "PO-Revision-Date: 2013-07-09 20:19-0300\n" 9 | "Last-Translator: Guillermo Movia \n" 10 | "Language-Team: LANGUAGE \n" 11 | "Language: \n" 12 | "MIME-Version: 1.0\n" 13 | "Content-Type: text/plain; charset=UTF-8\n" 14 | "Content-Transfer-Encoding: 8bit\n" 15 | "X-Generator: Poedit 1.5.5\n" 16 | 17 | #: browserid.php:131 browserid.php:909 18 | msgid "Sign in with your email" 19 | msgstr "Ingresa con tu correo electrónico" 20 | 21 | #: browserid.php:135 browserid.php:918 22 | msgid "Logout" 23 | msgstr "Salir" 24 | 25 | #: browserid.php:139 browserid.php:973 26 | msgid "Comment" 27 | msgstr "Comentario" 28 | 29 | #: browserid.php:164 30 | msgid "Settings" 31 | msgstr "Preferencias" 32 | 33 | #: browserid.php:269 browserid.php:395 34 | msgid "Verification failed" 35 | msgstr "Falló la verificación" 36 | 37 | #: browserid.php:388 38 | msgid "Verification response invalid" 39 | msgstr "La respuesta de la verificación es inválida" 40 | 41 | #: browserid.php:462 42 | msgid "You must already have an account to log in with Persona." 43 | msgstr "Debes tener al menos una cuenta para ingresar con Persona." 44 | 45 | #: browserid.php:491 46 | msgid "ERROR: Your account has been marked as a spammer." 47 | msgstr "ERROR: Tu cuenta ha sido marcada como spammer." 48 | 49 | #: browserid.php:497 50 | msgid "Site Suspended." 51 | msgstr "Sitio suspendido." 52 | 53 | #: browserid.php:594 54 | msgid "Register" 55 | msgstr "Registrarse" 56 | 57 | #: browserid.php:654 58 | msgid "Password reset disabled" 59 | msgstr "El reinicio de la contraseña está deshabilitado" 60 | 61 | #: browserid.php:655 62 | msgid "" 63 | "%s uses Mozilla Persona to sign in and does not use passwords. Password " 64 | "reset is disabled." 65 | msgstr "" 66 | "%s usa Mozilla Persona para ingresar y no usar contraseñas. El reinicio de " 67 | "la contraseña está deshabilitado." 68 | 69 | #: browserid.php:793 70 | msgid "What is Persona?" 71 | msgstr "¿Qué es Persona?" 72 | 73 | #: browserid.php:845 browserid.php:846 browserid.php:1031 74 | msgid "Mozilla Persona" 75 | msgstr "Mozilla Persona" 76 | 77 | #: browserid.php:845 78 | msgid "Administration" 79 | msgstr "Administración" 80 | 81 | #: browserid.php:856 82 | msgid "Site name:" 83 | msgstr "Nombre del sitio:" 84 | 85 | #: browserid.php:857 86 | msgid "Site logo:" 87 | msgstr "Logo del sitio:" 88 | 89 | #: browserid.php:858 90 | msgid "Disable non-Persona logins:" 91 | msgstr "Deshabilitar el ingreso sin Persona:" 92 | 93 | #: browserid.php:859 94 | msgid "Login button HTML:" 95 | msgstr "HTML del botón de ingreso:" 96 | 97 | #: browserid.php:860 98 | msgid "Logout button HTML:" 99 | msgstr "HTML del botón de salida:" 100 | 101 | #: browserid.php:862 102 | msgid "Login redirection URL:" 103 | msgstr "URL de redirección de ingreso:" 104 | 105 | #: browserid.php:863 106 | msgid "Enable for comments:" 107 | msgstr "Habilitar para comentarios:" 108 | 109 | #: browserid.php:864 110 | msgid "Enable bbPress integration:" 111 | msgstr "Habilitar integración con bbPress:" 112 | 113 | #: browserid.php:865 114 | msgid "Comment button HTML:" 115 | msgstr "HTML de botón de comentario:" 116 | 117 | #: browserid.php:866 118 | msgid "Verification server:" 119 | msgstr "Servidor de verificación:" 120 | 121 | #: browserid.php:867 122 | msgid "Debug mode:" 123 | msgstr "Modo depuración:" 124 | 125 | #: browserid.php:901 126 | msgid "Absolute path, works only with SSL" 127 | msgstr "Dirección absoluta, funciona solo con SSL" 128 | 129 | #: browserid.php:928 130 | msgid "Default WordPress dashboard" 131 | msgstr "Tablero predeterminado de WordPress" 132 | 133 | #: browserid.php:958 134 | msgid "Enables anonymous posting implicitly" 135 | msgstr "Permitir la publicación anónima" 136 | 137 | #: browserid.php:984 138 | msgid "Default" 139 | msgstr "Predeterminado" 140 | 141 | #: browserid.php:1004 142 | msgid "Security risk!" 143 | msgstr "¡Riesgo de seguridad!" 144 | 145 | #: browserid.php:1036 146 | msgid "Save Changes" 147 | msgstr "Guardar cambios" 148 | 149 | #: browserid.php:1109 150 | msgid "Mozilla Persona login button" 151 | msgstr "Botón de ingreso de Mozilla Persona" 152 | 153 | #: browserid.php:1140 154 | msgid "Title:" 155 | msgstr "Título:" 156 | 157 | #: browserid.php:1184 158 | msgid "New user registration on your site %s:" 159 | msgstr "Registro de nuevo usuario en tu sitio web %s:" 160 | 161 | #: browserid.php:1185 browserid.php:1193 162 | msgid "Username: %s" 163 | msgstr "Nombre de usuario: %s" 164 | 165 | #: browserid.php:1186 166 | msgid "E-mail: %s" 167 | msgstr "Correo electrónico: %s" 168 | 169 | #: browserid.php:1188 170 | msgid "[%s] New User Registration" 171 | msgstr "[%s] Registración de nuevo usuario" 172 | 173 | #: browserid.php:1202 174 | msgid "%s uses Mozilla Persona to sign in and does not use passwords" 175 | msgstr "%s usa Mozilla Persona para ingresar y no usar contraseñas" 176 | 177 | #: browserid.php:1203 178 | msgid "[%s] Your username" 179 | msgstr "[%s] Tu nombre de usuario" 180 | 181 | #: browserid.php:1205 182 | msgid "Password: %s" 183 | msgstr "Contraseña: %s" 184 | 185 | #: browserid.php:1206 186 | msgid "[%s] Your username and password" 187 | msgstr "[%s] Tu usuario y contraseña" 188 | -------------------------------------------------------------------------------- /lib/browserid-registration.php: -------------------------------------------------------------------------------- 1 | browserid_only_auth = $options['browserid_only_auth']; 34 | 35 | global $browserid_only_auth; 36 | $browserid_only_auth = $options['browserid_only_auth']; 37 | 38 | $this->ui = $options['ui']; 39 | $this->login = $options['login']; 40 | } 41 | 42 | public function Init() { 43 | if (! $this->browserid_only_auth) return; 44 | 45 | add_action('register_form', 46 | array(&$this, 'Add_browserid_to_registration_form')); 47 | add_action('user_register', 48 | array(&$this, 'Complete_new_user_creation')); 49 | add_filter('registration_errors', 50 | array(&$this, 'Disallow_non_browserid_registration_filter')); 51 | add_filter('registration_redirect', 52 | array(&$this, 'Registration_redirect_filter')); 53 | add_action('admin_init', 54 | array(&$this, 'Remove_password_nag_if_browserid_registration')); 55 | } 56 | 57 | public function Is_registration() { 58 | $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null; 59 | return $action == 'register'; 60 | } 61 | 62 | public function Handle_registration($email) { 63 | if ($this->browserid_only_auth) { 64 | // Keep track of whether the user is registering with 65 | // BrowserID. Non BrowserID registrations are disabled in 66 | // BrowserID only auth. 67 | $this->user_registering_with_browserid = true; 68 | $_POST['user_email'] = $email; 69 | } 70 | } 71 | 72 | 73 | // Add Persona button to registration form and remove the email form. 74 | public function Add_browserid_to_registration_form() { 75 | echo ''; 76 | 77 | $html = __('Register', c_bid_text_domain) ; 78 | $this->ui->Print_persona_button_html("js-persona__register", $html); 79 | } 80 | 81 | // Now that the user is registered, set a fake password and log them in 82 | public function Complete_new_user_creation($user_id) { 83 | add_user_meta($user_id, 'browserid_registration', $this->user_registering_with_browserid); 84 | if ($this->user_registering_with_browserid) { 85 | $this->login->Login_by_id($user_id, false); 86 | } 87 | } 88 | 89 | public function Remove_password_nag_if_browserid_registration() { 90 | global $user_ID; 91 | $registered_with_browserid = get_user_meta($user_ID, 'browserid_registration', true); 92 | if ($registered_with_browserid === true) { 93 | delete_user_setting('default_password_nag', $user_ID); 94 | update_user_option($user_ID, 'default_password_nag', false, true); 95 | } 96 | } 97 | 98 | // Check if traditional registration has been disabled. 99 | public function Disallow_non_browserid_registration_filter($errors) { 100 | if (! $this->user_registering_with_browserid) { 101 | $blogname = wp_specialchars_decode( 102 | get_option('blogname'), ENT_QUOTES); 103 | $errors->add('invalid_registration', 104 | sprintf(__('ERROR: ' 105 | . '%s uses Mozilla Persona for registration. ' 106 | . 'Please register using Persona.', 107 | c_bid_text_domain), $blogname)); 108 | } 109 | 110 | return $errors; 111 | } 112 | 113 | public function Registration_redirect_filter($redirect_to) { 114 | if ($redirect_to) return $redirect_to; 115 | 116 | // The user successfully signed up using Persona, 117 | // send them to their profile page 118 | return $this->Get_registration_redirect_url(); 119 | } 120 | 121 | // Get the registration redirect URL 122 | public function Get_registration_redirect_url() { 123 | return admin_url() . 'profile.php'; 124 | } 125 | } 126 | } 127 | 128 | if (!function_exists('wp_new_user_notification')) { 129 | function wp_new_user_notification($user_id, $plaintext_pass = '') { 130 | $user = get_userdata( $user_id ); 131 | 132 | $user_login = stripslashes($user->user_login); 133 | $user_email = stripslashes($user->user_email); 134 | 135 | // The blogname option is escaped with esc_html on the way into the database in sanitize_option 136 | // we want to reverse this for the plain text arena of emails. 137 | $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); 138 | 139 | $message = sprintf(__('New user registration on your site %s:'), $blogname) . "\r\n\r\n"; 140 | $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n"; 141 | $message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n"; 142 | 143 | @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message); 144 | 145 | if ( empty($plaintext_pass) ) 146 | return; 147 | 148 | $message = sprintf(__('Username: %s'), $user_login) . "\r\n"; 149 | $title = ''; 150 | 151 | global $browserid_only_auth; 152 | if ($browserid_only_auth) { 153 | $message .= sprintf(__('%s uses Mozilla Persona to sign in and does not use passwords', c_bid_text_domain), $blogname) . "\r\n"; 154 | $title .= sprintf(__('[%s] Your username'), $blogname); 155 | } else { 156 | $message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n"; 157 | $title .= sprintf(__('[%s] Your username and password'), $blogname); 158 | } 159 | $message .= wp_login_url() . "\r\n"; 160 | 161 | wp_mail($user_email, $title, $message); 162 | } 163 | } 164 | ?> 165 | -------------------------------------------------------------------------------- /languages/browserid-fr_CA.po: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "" 3 | "Project-Id-Version: Mozilla Persona v0.44\n" 4 | "Report-Msgid-Bugs-To: \n" 5 | "POT-Creation-Date: 2012-07-20 19:19+0100\n" 6 | "PO-Revision-Date: 2013-07-17 15:42:40+0000\n" 7 | "Last-Translator: Marcel Bokhorst\n" 8 | "Language-Team: \n" 9 | "Language: \n" 10 | "MIME-Version: 1.0\n" 11 | "Content-Type: text/plain; charset=UTF-8\n" 12 | "Content-Transfer-Encoding: 8bit\n" 13 | "Plural-Forms: nplurals=2; plural=n>1;\n" 14 | "X-Generator: CSL v1.x\n" 15 | "X-Poedit-Language: \n" 16 | "X-Poedit-Country: \n" 17 | "X-Poedit-SourceCharset: utf-8\n" 18 | "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;" 19 | "_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n" 20 | "X-Poedit-Basepath: .\n" 21 | "X-Poedit-Bookmarks: \n" 22 | "X-Poedit-SearchPath-0: .\n" 23 | "X-Textdomain-Support: yes\n" 24 | 25 | # @ browserid 26 | #: browserid.php:136 browserid.php:916 27 | msgid "Logout" 28 | msgstr "Se déconnecter" 29 | 30 | # @ browserid 31 | #: browserid.php:267 browserid.php:393 32 | msgid "Verification failed" 33 | msgstr "Échec de vérification" 34 | 35 | # @ browserid 36 | #: browserid.php:791 37 | msgid "What is Persona?" 38 | msgstr "Qu'est-ce que Persona ?" 39 | 40 | # @ browserid 41 | #: browserid.php:843 browserid.php:844 browserid.php:1043 42 | msgid "Mozilla Persona" 43 | msgstr "Mozilla Persona" 44 | 45 | # @ browserid 46 | #: browserid.php:843 47 | msgid "Administration" 48 | msgstr "Administration" 49 | 50 | # @ browserid 51 | #: browserid.php:854 52 | msgid "Site name:" 53 | msgstr "Nom du site :" 54 | 55 | # @ browserid 56 | #: browserid.php:855 57 | msgid "Site logo:" 58 | msgstr "Logo du site :" 59 | 60 | # @ browserid 61 | #: browserid.php:860 62 | msgid "Login redirection URL:" 63 | msgstr "URL de redirection après connexion :" 64 | 65 | # @ browserid 66 | #: browserid.php:861 67 | msgid "Enable for comments:" 68 | msgstr "Activer pour les commentaires :" 69 | 70 | # @ browserid 71 | #: browserid.php:862 72 | msgid "Enable bbPress integration:" 73 | msgstr "Activer l'intégration bbPress" 74 | 75 | # @ browserid 76 | #: browserid.php:864 77 | msgid "Verification server:" 78 | msgstr "Serveur de vérification :" 79 | 80 | # @ browserid 81 | #: browserid.php:865 82 | msgid "Debug mode:" 83 | msgstr "Mode debug :" 84 | 85 | # @ browserid 86 | #: browserid.php:899 87 | msgid "Absolute path, works only with SSL" 88 | msgstr "Chemin absolu, obligatoirement sur SSL" 89 | 90 | # @ browserid 91 | #: browserid.php:926 92 | msgid "Default WordPress dashboard" 93 | msgstr "Panneau WordPress standard" 94 | 95 | # @ browserid 96 | #: browserid.php:956 97 | msgid "Enables anonymous posting implicitly" 98 | msgstr "Active implicitement les commentaires anonymes" 99 | 100 | # @ browserid 101 | #: browserid.php:1016 102 | msgid "Security risk!" 103 | msgstr "Risque de sécurité !" 104 | 105 | # @ default 106 | #: browserid.php:1048 107 | msgid "Save Changes" 108 | msgstr "Sauvegarder les changements" 109 | 110 | # @ browserid 111 | #: browserid.php:1121 112 | msgid "Mozilla Persona login button" 113 | msgstr "Bouton de connexion Mozilla Persona" 114 | 115 | # @ default 116 | #: browserid.php:1152 117 | msgid "Title:" 118 | msgstr "Titre :" 119 | 120 | # @ browserid 121 | #: browserid.php:132 browserid.php:907 122 | msgid "Sign in with your email" 123 | msgstr "Se connecter avec votre courriel" 124 | 125 | # @ browserid 126 | #: browserid.php:162 127 | msgid "Settings" 128 | msgstr "Options" 129 | 130 | # @ browserid 131 | #: browserid.php:386 132 | msgid "Verification response invalid" 133 | msgstr "Résultat de vérification invalide" 134 | 135 | # @ browserid 136 | #: browserid.php:395 137 | msgid "reason" 138 | msgstr "raison" 139 | 140 | # @ browserid 141 | #: browserid.php:460 142 | msgid "You must already have an account to log in with Persona." 143 | msgstr "Vous devez déjà avoir un compte pour vous identifier avec Persona" 144 | 145 | # @ default 146 | #: browserid.php:489 147 | msgid "ERROR: Your account has been marked as a spammer." 148 | msgstr "" 149 | 150 | # @ default 151 | #: browserid.php:495 152 | msgid "Site Suspended." 153 | msgstr "" 154 | 155 | # @ browserid 156 | #: browserid.php:592 157 | msgid "Register" 158 | msgstr "Enregistrement" 159 | 160 | # @ browserid 161 | #: browserid.php:626 162 | #, php-format 163 | msgid "" 164 | "ERROR: %s uses Mozilla Persona for registration. Please " 165 | "register using Persona." 166 | msgstr "" 167 | "ERREUR: %s utilise Mozilla Persona pour l'enregistrement. " 168 | "Veuillez vous enregistrer en utilisant Persona." 169 | 170 | # @ browserid 171 | #: browserid.php:652 172 | msgid "Password reset disabled" 173 | msgstr "Remise à zéro du mot de passe désactivée" 174 | 175 | # @ browserid 176 | #: browserid.php:653 177 | #, php-format 178 | msgid "" 179 | "%s uses Mozilla Persona to sign in and does not use passwords. Password " 180 | "reset is disabled." 181 | msgstr "" 182 | "%s utilise Mozilla Persona pour la connexion et n'utilise pas de mot de " 183 | "passe. La remise à zéro du mot de passe est désactivée." 184 | 185 | # @ browserid 186 | #: browserid.php:856 187 | msgid "Disable non-Persona logins:" 188 | msgstr "Obliger les conexions avec Persona seulement:" 189 | 190 | # @ browserid 191 | #: browserid.php:857 192 | msgid "Login button HTML:" 193 | msgstr "HTML pour le bouton de connexion:" 194 | 195 | # @ browserid 196 | #: browserid.php:858 197 | msgid "Logout button HTML:" 198 | msgstr "HTML pour le bouton de déconnexion:" 199 | 200 | # @ browserid 201 | #: browserid.php:863 202 | msgid "Persona source:" 203 | msgstr "Source Persona:" 204 | 205 | # @ browserid 206 | #: browserid.php:972 browserid.php:993 207 | msgid "Default" 208 | msgstr "Défaut" 209 | 210 | # @ default 211 | #: browserid.php:1196 212 | #, php-format 213 | msgid "New user registration on your site %s:" 214 | msgstr "" 215 | 216 | # @ default 217 | #: browserid.php:1197 browserid.php:1205 218 | #, php-format 219 | msgid "Username: %s" 220 | msgstr "" 221 | 222 | # @ default 223 | #: browserid.php:1198 224 | #, php-format 225 | msgid "E-mail: %s" 226 | msgstr "" 227 | 228 | # @ default 229 | #: browserid.php:1200 230 | #, php-format 231 | msgid "[%s] New User Registration" 232 | msgstr "" 233 | 234 | # @ browserid 235 | #: browserid.php:1214 236 | #, php-format 237 | msgid "%s uses Mozilla Persona to sign in and does not use passwords" 238 | msgstr "" 239 | "%s utilise Mozilla Persona pour la connexion et n'utilise pas de mots de " 240 | "passe" 241 | 242 | # @ default 243 | #: browserid.php:1215 244 | #, php-format 245 | msgid "[%s] Your username" 246 | msgstr "" 247 | 248 | # @ default 249 | #: browserid.php:1217 250 | #, php-format 251 | msgid "Password: %s" 252 | msgstr "" 253 | 254 | # @ default 255 | #: browserid.php:1218 256 | #, php-format 257 | msgid "[%s] Your username and password" 258 | msgstr "" 259 | -------------------------------------------------------------------------------- /languages/browserid-fr_FR.po: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "" 3 | "Project-Id-Version: Mozilla Persona v0.44\n" 4 | "Report-Msgid-Bugs-To: \n" 5 | "POT-Creation-Date: 2012-07-20 19:19+0100\n" 6 | "PO-Revision-Date: 2013-07-17 15:43:25+0000\n" 7 | "Last-Translator: Marcel Bokhorst\n" 8 | "Language-Team: \n" 9 | "Language: \n" 10 | "MIME-Version: 1.0\n" 11 | "Content-Type: text/plain; charset=UTF-8\n" 12 | "Content-Transfer-Encoding: 8bit\n" 13 | "Plural-Forms: nplurals=2; plural=n>1;\n" 14 | "X-Generator: CSL v1.x\n" 15 | "X-Poedit-Language: \n" 16 | "X-Poedit-Country: \n" 17 | "X-Poedit-SourceCharset: utf-8\n" 18 | "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;" 19 | "_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n" 20 | "X-Poedit-Basepath: .\n" 21 | "X-Poedit-Bookmarks: \n" 22 | "X-Poedit-SearchPath-0: .\n" 23 | "X-Textdomain-Support: yes\n" 24 | 25 | # @ browserid 26 | #: browserid.php:136 browserid.php:916 27 | msgid "Logout" 28 | msgstr "Se déconnecter" 29 | 30 | # @ browserid 31 | #: browserid.php:267 browserid.php:393 32 | msgid "Verification failed" 33 | msgstr "Échec de vérification" 34 | 35 | # @ browserid 36 | #: browserid.php:791 37 | msgid "What is Persona?" 38 | msgstr "Qu'est-ce que Persona ?" 39 | 40 | # @ browserid 41 | #: browserid.php:843 browserid.php:844 browserid.php:1043 42 | msgid "Mozilla Persona" 43 | msgstr "Mozilla Persona" 44 | 45 | # @ browserid 46 | #: browserid.php:843 47 | msgid "Administration" 48 | msgstr "Administration" 49 | 50 | # @ browserid 51 | #: browserid.php:854 52 | msgid "Site name:" 53 | msgstr "Nom du site :" 54 | 55 | # @ browserid 56 | #: browserid.php:855 57 | msgid "Site logo:" 58 | msgstr "Logo du site :" 59 | 60 | # @ browserid 61 | #: browserid.php:860 62 | msgid "Login redirection URL:" 63 | msgstr "URL de redirection après connexion :" 64 | 65 | # @ browserid 66 | #: browserid.php:861 67 | msgid "Enable for comments:" 68 | msgstr "Activer pour les commentaires :" 69 | 70 | # @ browserid 71 | #: browserid.php:862 72 | msgid "Enable bbPress integration:" 73 | msgstr "Activer l'intégration bbPress" 74 | 75 | # @ browserid 76 | #: browserid.php:864 77 | msgid "Verification server:" 78 | msgstr "Serveur de vérification :" 79 | 80 | # @ browserid 81 | #: browserid.php:865 82 | msgid "Debug mode:" 83 | msgstr "Mode debug :" 84 | 85 | # @ browserid 86 | #: browserid.php:899 87 | msgid "Absolute path, works only with SSL" 88 | msgstr "Chemin absolu, obligatoirement sur SSL" 89 | 90 | # @ browserid 91 | #: browserid.php:926 92 | msgid "Default WordPress dashboard" 93 | msgstr "Panneau WordPress standard" 94 | 95 | # @ browserid 96 | #: browserid.php:956 97 | msgid "Enables anonymous posting implicitly" 98 | msgstr "Active implicitement les commentaires anonymes" 99 | 100 | # @ browserid 101 | #: browserid.php:1016 102 | msgid "Security risk!" 103 | msgstr "Risque de sécurité !" 104 | 105 | # @ default 106 | #: browserid.php:1048 107 | msgid "Save Changes" 108 | msgstr "Sauvegarder les changements" 109 | 110 | # @ browserid 111 | #: browserid.php:1121 112 | msgid "Mozilla Persona login button" 113 | msgstr "Bouton de connexion Mozilla Persona" 114 | 115 | # @ default 116 | #: browserid.php:1152 117 | msgid "Title:" 118 | msgstr "Titre :" 119 | 120 | # @ browserid 121 | #: browserid.php:132 browserid.php:907 122 | msgid "Sign in with your email" 123 | msgstr "Se connecter avec votre email" 124 | 125 | # @ browserid 126 | #: browserid.php:162 127 | msgid "Settings" 128 | msgstr "Options" 129 | 130 | # @ browserid 131 | #: browserid.php:386 132 | msgid "Verification response invalid" 133 | msgstr "Résultat de vérification invalide" 134 | 135 | # @ browserid 136 | #: browserid.php:395 137 | msgid "reason" 138 | msgstr "raison" 139 | 140 | # @ browserid 141 | #: browserid.php:460 142 | msgid "You must already have an account to log in with Persona." 143 | msgstr "Vous devez déjà avoir un compte pour vous identifier avec Persona" 144 | 145 | # @ default 146 | #: browserid.php:489 147 | msgid "ERROR: Your account has been marked as a spammer." 148 | msgstr "" 149 | 150 | # @ default 151 | #: browserid.php:495 152 | msgid "Site Suspended." 153 | msgstr "" 154 | 155 | # @ browserid 156 | #: browserid.php:592 157 | msgid "Register" 158 | msgstr "Enregistrement" 159 | 160 | # @ browserid 161 | #: browserid.php:626 162 | #, php-format 163 | msgid "" 164 | "ERROR: %s uses Mozilla Persona for registration. Please " 165 | "register using Persona." 166 | msgstr "" 167 | "ERREUR: %s utilise Mozilla Persona pour l'enregistrement. " 168 | "Veuillez vous enregistrer en utilisant Persona." 169 | 170 | # @ browserid 171 | #: browserid.php:652 172 | msgid "Password reset disabled" 173 | msgstr "Remise à zéro du mot de passe désactivée" 174 | 175 | # @ browserid 176 | #: browserid.php:653 177 | #, php-format 178 | msgid "" 179 | "%s uses Mozilla Persona to sign in and does not use passwords. Password " 180 | "reset is disabled." 181 | msgstr "" 182 | "%s utilise Mozilla Persona pour la connexion et n'utilise pas de mot de " 183 | "passe. La remise à zéro du mot de passe est désactivée." 184 | 185 | # @ browserid 186 | #: browserid.php:856 187 | msgid "Disable non-Persona logins:" 188 | msgstr "Obliger les conexions avec Persona seulement:" 189 | 190 | # @ browserid 191 | #: browserid.php:857 192 | msgid "Login button HTML:" 193 | msgstr "HTML pour le bouton de connexion:" 194 | 195 | # @ browserid 196 | #: browserid.php:858 197 | msgid "Logout button HTML:" 198 | msgstr "HTML pour le bouton de déconnexion:" 199 | 200 | # @ browserid 201 | #: browserid.php:863 202 | msgid "Persona source:" 203 | msgstr "Source Persona:" 204 | 205 | # @ browserid 206 | #: browserid.php:972 browserid.php:993 207 | msgid "Default" 208 | msgstr "Défaut" 209 | 210 | # @ default 211 | #: browserid.php:1196 212 | #, php-format 213 | msgid "New user registration on your site %s:" 214 | msgstr "" 215 | 216 | # @ default 217 | #: browserid.php:1197 browserid.php:1205 218 | #, php-format 219 | msgid "Username: %s" 220 | msgstr "" 221 | 222 | # @ default 223 | #: browserid.php:1198 224 | #, php-format 225 | msgid "E-mail: %s" 226 | msgstr "" 227 | 228 | # @ default 229 | #: browserid.php:1200 230 | #, php-format 231 | msgid "[%s] New User Registration" 232 | msgstr "" 233 | 234 | # @ browserid 235 | #: browserid.php:1214 236 | #, php-format 237 | msgid "%s uses Mozilla Persona to sign in and does not use passwords" 238 | msgstr "" 239 | "%s utilise Mozilla Persona pour la connexion et n'utilise pas de mots de " 240 | "passe" 241 | 242 | # @ default 243 | #: browserid.php:1215 244 | #, php-format 245 | msgid "[%s] Your username" 246 | msgstr "" 247 | 248 | # @ default 249 | #: browserid.php:1217 250 | #, php-format 251 | msgid "Password: %s" 252 | msgstr "" 253 | 254 | # @ default 255 | #: browserid.php:1218 256 | #, php-format 257 | msgid "[%s] Your username and password" 258 | msgstr "" 259 | -------------------------------------------------------------------------------- /lib/browserid-login.php: -------------------------------------------------------------------------------- 1 | is_browserid_only_auth = $options['is_browserid_only_auth']; 34 | $this->ui = $options['ui']; 35 | $this->option_redirect_url = $options['option_redirect_url']; 36 | $this->request_redirect_url = $options['request_redirect_url']; 37 | $this->login_html = $options['login_html']; 38 | $this->logout_html = $options['logout_html']; 39 | } 40 | 41 | public function Init() { 42 | // Authentication 43 | add_action('set_auth_cookie', 44 | array(&$this, 'Set_cookie_if_persona_login'), 10, 5); 45 | 46 | add_action('clear_auth_cookie', 47 | array(&$this, 'Clear_persona_login_cookie')); 48 | 49 | if ($this->is_browserid_only_auth) { 50 | add_filter('wp_authenticate_user', 51 | array(&$this, 'Disallow_non_persona_logins')); 52 | } 53 | 54 | add_filter('check_password', 55 | array(&$this, 'Allow_fake_password_if_persona_login')); 56 | 57 | add_action('login_form', 58 | array(&$this, 'Add_persona_to_login_form')); 59 | 60 | } 61 | 62 | public function Set_cookie_if_persona_login( 63 | $auth_cookie, $expire, $expiration, $user_id, $scheme) { 64 | // Persona should only manage Persona logins. If this is 65 | // a Persona login, keep track of it so that the user is 66 | // not automatically logged out if they log in via other means. 67 | if ($this->is_browserid_login) { 68 | $secure = $scheme == "secure_auth"; 69 | setcookie(c_bid_browserid_login_cookie, 1, $expire, 70 | COOKIEPATH, COOKIE_DOMAIN, $secure, true); 71 | } 72 | else { 73 | // If the user is not logged in via BrowserID, clear the 74 | // cookie. 75 | $this->Clear_persona_login_cookie(); 76 | } 77 | } 78 | 79 | public function Clear_persona_login_cookie() { 80 | $expire = time() - YEAR_IN_SECONDS; 81 | setcookie(c_bid_browserid_login_cookie, ' ', $expire, 82 | COOKIEPATH, COOKIE_DOMAIN); 83 | } 84 | 85 | public function Disallow_non_persona_logins($user) { 86 | if (! $this->is_browserid_login) { 87 | return new WP_error('invalid_login', 88 | 'Only Persona logins are allowed'); 89 | } 90 | 91 | return $user; 92 | } 93 | 94 | 95 | public function Allow_fake_password_if_persona_login($check) { 96 | // Passwords are handled by assertions in Persona authentication. 97 | // If this is a Persona login, the password is always good. This 98 | // allows for the fake password to be passed to wp_login above. 99 | if ($this->is_browserid_login) { 100 | return true; 101 | } 102 | 103 | return $check; 104 | } 105 | 106 | // Add login button to login page 107 | public function Add_persona_to_login_form() { 108 | echo 109 | '

' . 110 | $this->Get_loginout_html(false) . '

' . 111 | '

'; 112 | } 113 | 114 | public function Get_rememberme() { 115 | return (isset($_REQUEST['rememberme']) 116 | && $_REQUEST['rememberme'] == 'true'); 117 | } 118 | 119 | // Process login 120 | public function Handle_login($email) { 121 | // Login 122 | $user = $this->Login_by_email($email, $this->Get_rememberme()); 123 | if ($user) { 124 | // Beam me up, Scotty! 125 | $redirect_to = $this->Get_login_redirect_url(); 126 | $redirect_to = apply_filters( 127 | 'login_redirect', $redirect_to, '', $user); 128 | wp_redirect($redirect_to); 129 | exit(); 130 | } 131 | else { 132 | $message = __('You must already have an account to log in with Persona.', c_bid_text_domain); 133 | $this->ui->Handle_error($message); 134 | } 135 | } 136 | 137 | // Login user using e-mail address 138 | public function Login_by_email($email, $rememberme) { 139 | $userdata = get_user_by('email', $email); 140 | return $this->Login_by_userdata($userdata, $rememberme); 141 | } 142 | 143 | // Login user using id 144 | public function Login_by_id($user_id, $rememberme) { 145 | $userdata = get_user_by('id', $user_id); 146 | return $this->Login_by_userdata($userdata, $rememberme); 147 | } 148 | 149 | // Login user by userdata 150 | public function Login_by_userdata($userdata, $rememberme) { 151 | global $user; 152 | $user = null; 153 | 154 | if ($userdata) { 155 | $this->is_browserid_login = true; 156 | $user = wp_signon(array( 157 | 'user_login' => $userdata->user_login, 158 | 'user_password' => 'fake_password', 159 | 'remember' => true 160 | )); 161 | } 162 | 163 | return $user; 164 | } 165 | 166 | // Get the currently logged in user, iff they authenticated 167 | // using BrowserID 168 | public function Get_browserid_logged_in_user() { 169 | global $user_email; 170 | get_currentuserinfo(); 171 | 172 | if ( isset( $_COOKIE[c_bid_browserid_login_cookie] ) ) { 173 | return $user_email; 174 | } 175 | 176 | return null; 177 | } 178 | 179 | public function Get_login_redirect_url() { 180 | // first, if a redirect is specified in the request, use that. 181 | // second, if it is a new user and a new user redirect url is 182 | // specified, go there. 183 | // third, if if the global login redirect is specified, use that. 184 | // forth, use the admin URL. 185 | 186 | if(!empty($this->request_redirect_url)) { 187 | $redirect_to = $this->request_redirect_url; 188 | } else if(!empty($this->option_redirect_url)) { 189 | $redirect_to = $this->option_redirect_url; 190 | } else { 191 | $redirect_to = admin_url(); 192 | } 193 | 194 | return $redirect_to; 195 | } 196 | 197 | public function Get_loginout_html($check_login = true) { 198 | if ($check_login && is_user_logged_in()) { 199 | $html = $this->logout_html; 200 | 201 | // Simple link 202 | if (empty($html)) 203 | return ''; 204 | else 205 | return '' . $html . ''; 206 | } 207 | else { 208 | // User not logged in 209 | $html = $this->login_html; 210 | // Button 211 | $html = $this->ui->Get_persona_button_html("js-persona__login", $html); 212 | 213 | return $html; 214 | } 215 | } 216 | } 217 | } 218 | ?> 219 | -------------------------------------------------------------------------------- /languages/browserid-nl_NL.po: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "" 3 | "Project-Id-Version: \n" 4 | "POT-Creation-Date: 2013-07-28 22:13+0100\n" 5 | "PO-Revision-Date: \n" 6 | "Last-Translator: Jan Willem Oostendorp \n" 7 | "Language-Team: \n" 8 | "Language: nl_NL\n" 9 | "MIME-Version: 1.0\n" 10 | "Content-Type: text/plain; charset=UTF-8\n" 11 | "Content-Transfer-Encoding: 8bit\n" 12 | "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;" 13 | "_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;_ex:1,2c;" 14 | "esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c\n" 15 | "X-Poedit-Basepath: .\n" 16 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 17 | "X-Generator: Poedit 1.5.3\n" 18 | "X-Poedit-SearchPath-0: .\n" 19 | "X-Poedit-SearchPath-1: ..\n" 20 | 21 | #: ../browserid.php:155 ../browserid.php:1003 22 | msgid "Sign in with your email" 23 | msgstr "Log in met je email" 24 | 25 | #: ../browserid.php:159 ../browserid.php:1008 26 | msgid "Logout" 27 | msgstr "Log uit" 28 | 29 | #: ../browserid.php:185 30 | msgid "Settings" 31 | msgstr "Instellingen" 32 | 33 | #: ../browserid.php:294 ../browserid.php:420 34 | msgid "Verification failed" 35 | msgstr "Verificatie mislukt" 36 | 37 | #: ../browserid.php:413 38 | msgid "Verification response invalid" 39 | msgstr "Verificatie antwoord ongeldig" 40 | 41 | #: ../browserid.php:487 42 | msgid "You must already have an account to log in with Persona." 43 | msgstr "Je moet al een Persona account hebben voordat je kunt inloggen" 44 | 45 | #: ../browserid.php:615 46 | msgid "Register" 47 | msgstr "Registreer" 48 | 49 | #: ../browserid.php:647 50 | #, php-format 51 | msgid "" 52 | "ERROR: %s uses Mozilla Persona for registration. Please " 53 | "register using Persona." 54 | msgstr "" 55 | "ERROR: %s maakt gebruikt van Mozilla Persona voor " 56 | "registratie. Registreer je met Persona." 57 | 58 | #: ../browserid.php:674 59 | msgid "Password reset disabled" 60 | msgstr "Wachtwoord reset is uitgeschakeld" 61 | 62 | #: ../browserid.php:675 63 | #, php-format 64 | msgid "" 65 | "%s uses Mozilla Persona to sign in and does not use passwords. Password " 66 | "reset is disabled." 67 | msgstr "" 68 | "%s maakt gebruik van Mozilla Persona om in te loggen en gebruikt geen " 69 | "wachtwoorden. Wachtwoord reset is uitgeschakeld." 70 | 71 | #: ../browserid.php:741 ../browserid.php:743 72 | msgid "Comment must be submitted using Persona" 73 | msgstr "Reactie moet via Persona ingestuurd worden" 74 | 75 | #: ../browserid.php:830 76 | msgid "What is Persona?" 77 | msgstr "Wat is Persona?" 78 | 79 | #: ../browserid.php:861 ../browserid.php:862 ../browserid.php:1146 80 | msgid "Mozilla Persona" 81 | msgstr "Mozilla Persona" 82 | 83 | #: ../browserid.php:861 84 | msgid "Administration" 85 | msgstr "Administratie" 86 | 87 | #: ../browserid.php:872 88 | msgid "Site name:" 89 | msgstr "Website naam:" 90 | 91 | #: ../browserid.php:873 92 | msgid "Site logo:" 93 | msgstr "Website logo:" 94 | 95 | #: ../browserid.php:874 96 | msgid "Dialog background color:" 97 | msgstr "Popup achtergrond kleur:" 98 | 99 | #: ../browserid.php:876 100 | msgid "Terms of service:" 101 | msgstr "Gebruikersvoorwaarden:" 102 | 103 | #: ../browserid.php:878 104 | msgid "Privacy policy:" 105 | msgstr "Privacybeleid:" 106 | 107 | #: ../browserid.php:880 108 | msgid "Disable non-Persona logins:" 109 | msgstr "Schakel niet-Persona logins uit:" 110 | 111 | #: ../browserid.php:881 112 | msgid "Login button color:" 113 | msgstr "Login knop kleur:" 114 | 115 | #: ../browserid.php:883 116 | msgid "Login button HTML:" 117 | msgstr "Login knop HTML:" 118 | 119 | #: ../browserid.php:884 120 | msgid "Logout button HTML:" 121 | msgstr "Uitlog knop HTML:" 122 | 123 | #: ../browserid.php:886 124 | msgid "Login redirection URL:" 125 | msgstr "Login doorstuur URL:" 126 | 127 | #: ../browserid.php:887 128 | msgid "Enable for comments:" 129 | msgstr "Inschakelen op reacties" 130 | 131 | #: ../browserid.php:888 132 | msgid "Comment button HTML:" 133 | msgstr "Reacties knop HTML:" 134 | 135 | #: ../browserid.php:890 136 | msgid "Enable bbPress integration:" 137 | msgstr "Schakel bbPress intergratie in:" 138 | 139 | #: ../browserid.php:891 140 | msgid "Persona source:" 141 | msgstr "Persona bron:" 142 | 143 | #: ../browserid.php:892 144 | msgid "Verification server:" 145 | msgstr "Verificatie server:" 146 | 147 | #: ../browserid.php:893 148 | msgid "Debug mode:" 149 | msgstr "Debug modus:" 150 | 151 | #: ../browserid.php:953 152 | msgid "Absolute path, works only with SSL" 153 | msgstr "Absoluut pad, werkt alleen met SSL" 154 | 155 | #: ../browserid.php:969 156 | msgid "3 or 6 character hex value. e.g. #333 or #333333" 157 | msgstr "3 of 6 karakter hexidecimale waarde. b.v. #333 or #333333" 158 | 159 | #: ../browserid.php:981 160 | msgid "Absolute path, must be defined together with Privacy policy" 161 | msgstr "Absoluut pad, moet gedefinieerd zijn samen met Privicybeleid" 162 | 163 | #: ../browserid.php:992 164 | msgid "Absolute path, must be defined together with Terms of service" 165 | msgstr "Absoluut pad, moet gedefinieerd zijn samen met Gebruikersvoorwaarden" 166 | 167 | #: ../browserid.php:1014 168 | msgid "Default WordPress dashboard" 169 | msgstr "Standaard WordPress dashboard" 170 | 171 | #: ../browserid.php:1035 172 | msgid "Post Comment" 173 | msgstr "Verstuur Reactie" 174 | 175 | #: ../browserid.php:1039 176 | msgid "post comment" 177 | msgstr "rverstuur Reactie" 178 | 179 | #: ../browserid.php:1048 180 | msgid "Enables anonymous posting implicitly" 181 | msgstr "Maakt anoniem posten impliciet" 182 | 183 | #: ../browserid.php:1061 ../browserid.php:1071 184 | msgid "Default" 185 | msgstr "Standaard" 186 | 187 | #: ../browserid.php:1093 188 | msgid "Security risk!" 189 | msgstr "Beveiligings risico!" 190 | 191 | #: ../browserid.php:1118 192 | msgid "Blue" 193 | msgstr "Blauw" 194 | 195 | #: ../browserid.php:1119 196 | msgid "Black" 197 | msgstr "Zwart" 198 | 199 | #: ../browserid.php:1120 200 | msgid "Orange" 201 | msgstr "Oranje" 202 | 203 | #: ../browserid.php:1151 204 | msgid "Save Changes" 205 | msgstr "Wijzigingen Opslaan" 206 | 207 | #: ../browserid.php:1224 208 | msgid "Mozilla Persona login button" 209 | msgstr "Mozilla Persona login knop" 210 | 211 | #: ../browserid.php:1255 212 | msgid "Title:" 213 | msgstr "Titel:" 214 | 215 | #: ../browserid.php:1299 216 | #, php-format 217 | msgid "New user registration on your site %s:" 218 | msgstr "Nieuwe gebruiker registratie op je site %s:" 219 | 220 | #: ../browserid.php:1300 ../browserid.php:1308 221 | #, php-format 222 | msgid "Username: %s" 223 | msgstr "Gebruikersnaam: %s" 224 | 225 | #: ../browserid.php:1301 226 | #, php-format 227 | msgid "E-mail: %s" 228 | msgstr "E-mail: %s" 229 | 230 | #: ../browserid.php:1303 231 | #, php-format 232 | msgid "[%s] New User Registration" 233 | msgstr "[%s] Nieuwe Gebruiker Registratie" 234 | 235 | #: ../browserid.php:1317 236 | #, php-format 237 | msgid "%s uses Mozilla Persona to sign in and does not use passwords" 238 | msgstr "" 239 | "%s maakt gebruik van Mozilla Persona om in te loggen en gebruikt geen " 240 | "wachtwoorden" 241 | 242 | #: ../browserid.php:1318 243 | #, php-format 244 | msgid "[%s] Your username" 245 | msgstr "[%s] Jou gebruikersnaam" 246 | 247 | #: ../browserid.php:1320 248 | #, php-format 249 | msgid "Password: %s" 250 | msgstr "Wachtwoord: %s" 251 | 252 | #: ../browserid.php:1321 253 | #, php-format 254 | msgid "[%s] Your username and password" 255 | msgstr "[%s] Jou gebruiksnaam en wachtwoord" 256 | -------------------------------------------------------------------------------- /locale/browserid.pot: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the PACKAGE package. 4 | # FIRST AUTHOR , YEAR. 5 | # 6 | #, fuzzy 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: browserid-wordpress\n" 10 | "Report-Msgid-Bugs-To: \n" 11 | "POT-Creation-Date: 2013-07-19 18:23+0100\n" 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 13 | "Last-Translator: FULL NAME \n" 14 | "Language-Team: LANGUAGE \n" 15 | "Language: \n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=utf-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | 20 | #: ../lib/browserid.php:132 ../lib/browserid.php:919 21 | #: scripts/../lib/browserid.php:132 scripts/../lib/browserid.php:919 22 | #: ../lib/browserid.php:132 ../lib/browserid.php:919 23 | msgid "Sign in with your email" 24 | msgstr "" 25 | 26 | #: ../lib/browserid.php:136 ../lib/browserid.php:928 27 | #: scripts/../lib/browserid.php:136 scripts/../lib/browserid.php:928 28 | #: ../lib/browserid.php:136 ../lib/browserid.php:928 29 | msgid "Logout" 30 | msgstr "" 31 | 32 | #: ../lib/browserid.php:162 scripts/../lib/browserid.php:162 33 | #: ../lib/browserid.php:162 34 | msgid "Settings" 35 | msgstr "" 36 | 37 | #: ../lib/browserid.php:267 ../lib/browserid.php:393 38 | #: scripts/../lib/browserid.php:267 scripts/../lib/browserid.php:393 39 | #: ../lib/browserid.php:267 ../lib/browserid.php:393 40 | msgid "Verification failed" 41 | msgstr "" 42 | 43 | #: ../lib/browserid.php:386 scripts/../lib/browserid.php:386 44 | #: ../lib/browserid.php:386 45 | msgid "Verification response invalid" 46 | msgstr "" 47 | 48 | #: ../lib/browserid.php:460 scripts/../lib/browserid.php:460 49 | #: ../lib/browserid.php:460 50 | msgid "You must already have an account to log in with Persona." 51 | msgstr "" 52 | 53 | #: ../lib/browserid.php:489 scripts/../lib/browserid.php:489 54 | #: ../lib/browserid.php:489 55 | msgid "ERROR: Your account has been marked as a spammer." 56 | msgstr "" 57 | 58 | #: ../lib/browserid.php:495 scripts/../lib/browserid.php:495 59 | #: ../lib/browserid.php:495 60 | msgid "Site Suspended." 61 | msgstr "" 62 | 63 | #: ../lib/browserid.php:592 scripts/../lib/browserid.php:592 64 | #: ../lib/browserid.php:592 65 | msgid "Register" 66 | msgstr "" 67 | 68 | #: ../lib/browserid.php:624 scripts/../lib/browserid.php:624 69 | #: ../lib/browserid.php:624 70 | #, php-format 71 | msgid "" 72 | "ERROR: %s uses Mozilla Persona for registration. Please " 73 | "register using Persona." 74 | msgstr "" 75 | 76 | #: ../lib/browserid.php:652 scripts/../lib/browserid.php:652 77 | #: ../lib/browserid.php:652 78 | msgid "Password reset disabled" 79 | msgstr "" 80 | 81 | #: ../lib/browserid.php:653 scripts/../lib/browserid.php:653 82 | #: ../lib/browserid.php:653 83 | #, php-format 84 | msgid "" 85 | "%s uses Mozilla Persona to sign in and does not use passwords. Password " 86 | "reset is disabled." 87 | msgstr "" 88 | 89 | #: ../lib/browserid.php:715 ../lib/browserid.php:717 90 | #: scripts/../lib/browserid.php:715 scripts/../lib/browserid.php:717 91 | #: ../lib/browserid.php:715 ../lib/browserid.php:717 92 | msgid "Comment must be submitted using Persona" 93 | msgstr "" 94 | 95 | #: ../lib/browserid.php:803 scripts/../lib/browserid.php:803 96 | #: ../lib/browserid.php:803 97 | msgid "What is Persona?" 98 | msgstr "" 99 | 100 | #: ../lib/browserid.php:855 ../lib/browserid.php:856 101 | #: scripts/../lib/browserid.php:855 scripts/../lib/browserid.php:856 102 | #: ../lib/browserid.php:855 ../lib/browserid.php:856 103 | msgid "Mozilla Persona" 104 | msgstr "" 105 | 106 | #: ../lib/browserid.php:855 scripts/../lib/browserid.php:855 107 | #: ../lib/browserid.php:855 108 | msgid "Administration" 109 | msgstr "" 110 | 111 | #: ../lib/browserid.php:866 scripts/../lib/browserid.php:866 112 | #: ../lib/browserid.php:866 113 | msgid "Site name:" 114 | msgstr "" 115 | 116 | #: ../lib/browserid.php:867 scripts/../lib/browserid.php:867 117 | #: ../lib/browserid.php:867 118 | msgid "Site logo:" 119 | msgstr "" 120 | 121 | #: ../lib/browserid.php:868 scripts/../lib/browserid.php:868 122 | #: ../lib/browserid.php:868 123 | msgid "Disable non-Persona logins:" 124 | msgstr "" 125 | 126 | #: ../lib/browserid.php:869 scripts/../lib/browserid.php:869 127 | #: ../lib/browserid.php:869 128 | msgid "Login button HTML:" 129 | msgstr "" 130 | 131 | #: ../lib/browserid.php:870 scripts/../lib/browserid.php:870 132 | #: ../lib/browserid.php:870 133 | msgid "Logout button HTML:" 134 | msgstr "" 135 | 136 | #: ../lib/browserid.php:872 scripts/../lib/browserid.php:872 137 | #: ../lib/browserid.php:872 138 | msgid "Login redirection URL:" 139 | msgstr "" 140 | 141 | #: ../lib/browserid.php:873 scripts/../lib/browserid.php:873 142 | #: ../lib/browserid.php:873 143 | msgid "Enable for comments:" 144 | msgstr "" 145 | 146 | #: ../lib/browserid.php:874 scripts/../lib/browserid.php:874 147 | #: ../lib/browserid.php:874 148 | msgid "Enable bbPress integration:" 149 | msgstr "" 150 | 151 | #: ../lib/browserid.php:875 scripts/../lib/browserid.php:875 152 | #: ../lib/browserid.php:875 153 | msgid "Persona source:" 154 | msgstr "" 155 | 156 | #: ../lib/browserid.php:876 scripts/../lib/browserid.php:876 157 | #: ../lib/browserid.php:876 158 | msgid "Verification server:" 159 | msgstr "" 160 | 161 | #: ../lib/browserid.php:877 scripts/../lib/browserid.php:877 162 | #: ../lib/browserid.php:877 163 | msgid "Debug mode:" 164 | msgstr "" 165 | 166 | #: ../lib/browserid.php:911 scripts/../lib/browserid.php:911 167 | #: ../lib/browserid.php:911 168 | msgid "Absolute path, works only with SSL" 169 | msgstr "" 170 | 171 | #: ../lib/browserid.php:938 scripts/../lib/browserid.php:938 172 | #: ../lib/browserid.php:938 173 | msgid "Default WordPress dashboard" 174 | msgstr "" 175 | 176 | #: ../lib/browserid.php:968 scripts/../lib/browserid.php:968 177 | #: ../lib/browserid.php:968 178 | msgid "Enables anonymous posting implicitly" 179 | msgstr "" 180 | 181 | #: ../lib/browserid.php:984 ../lib/browserid.php:1005 182 | #: scripts/../lib/browserid.php:984 scripts/../lib/browserid.php:1005 183 | #: ../lib/browserid.php:984 ../lib/browserid.php:1005 184 | msgid "Default" 185 | msgstr "" 186 | 187 | #: ../lib/browserid.php:1028 scripts/../lib/browserid.php:1028 188 | #: ../lib/browserid.php:1028 189 | msgid "Security risk!" 190 | msgstr "" 191 | 192 | #: ../lib/browserid.php:1133 scripts/../lib/browserid.php:1133 193 | #: ../lib/browserid.php:1133 194 | msgid "Mozilla Persona login button" 195 | msgstr "" 196 | 197 | #: ../lib/browserid.php:1208 scripts/../lib/browserid.php:1208 198 | #: ../lib/browserid.php:1208 199 | #, php-format 200 | msgid "New user registration on your site %s:" 201 | msgstr "" 202 | 203 | #: ../lib/browserid.php:1209 ../lib/browserid.php:1217 204 | #: scripts/../lib/browserid.php:1209 scripts/../lib/browserid.php:1217 205 | #: ../lib/browserid.php:1209 ../lib/browserid.php:1217 206 | #, php-format 207 | msgid "Username: %s" 208 | msgstr "" 209 | 210 | #: ../lib/browserid.php:1210 scripts/../lib/browserid.php:1210 211 | #: ../lib/browserid.php:1210 212 | #, php-format 213 | msgid "E-mail: %s" 214 | msgstr "" 215 | 216 | #: ../lib/browserid.php:1212 scripts/../lib/browserid.php:1212 217 | #: ../lib/browserid.php:1212 218 | #, php-format 219 | msgid "[%s] New User Registration" 220 | msgstr "" 221 | 222 | #: ../lib/browserid.php:1226 scripts/../lib/browserid.php:1226 223 | #: ../lib/browserid.php:1226 224 | #, php-format 225 | msgid "%s uses Mozilla Persona to sign in and does not use passwords" 226 | msgstr "" 227 | 228 | #: ../lib/browserid.php:1227 scripts/../lib/browserid.php:1227 229 | #: ../lib/browserid.php:1227 230 | #, php-format 231 | msgid "[%s] Your username" 232 | msgstr "" 233 | 234 | #: ../lib/browserid.php:1229 scripts/../lib/browserid.php:1229 235 | #: ../lib/browserid.php:1229 236 | #, php-format 237 | msgid "Password: %s" 238 | msgstr "" 239 | 240 | #: ../lib/browserid.php:1230 scripts/../lib/browserid.php:1230 241 | #: ../lib/browserid.php:1230 242 | #, php-format 243 | msgid "[%s] Your username and password" 244 | msgstr "" 245 | -------------------------------------------------------------------------------- /languages/browserid-ja_JP.po: -------------------------------------------------------------------------------- 1 | # This file is public domain 2 | msgid "" 3 | msgstr "" 4 | "Project-Id-Version: browserid-wordpress v0.45\n" 5 | "Report-Msgid-Bugs-To: \n" 6 | "POT-Creation-Date: 2013-07-19 18:23+0100\n" 7 | "PO-Revision-Date: 2013-08-30 10:34+0900\n" 8 | "Last-Translator: Makoto Kato \n" 9 | "Language-Team: \n" 10 | "Language: \n" 11 | "MIME-Version: 1.0\n" 12 | "Content-Type: text/plain; charset=UTF-8\n" 13 | "Content-Transfer-Encoding: 8bit\n" 14 | 15 | #: ../lib/browserid.php:132 ../lib/browserid.php:919 16 | #: scripts/../lib/browserid.php:132 scripts/../lib/browserid.php:919 17 | #: ../lib/browserid.php:132 ../lib/browserid.php:919 18 | msgid "Sign in with your email" 19 | msgstr "あなたのメールアドレスでサインインする" 20 | 21 | #: ../lib/browserid.php:136 ../lib/browserid.php:928 22 | #: scripts/../lib/browserid.php:136 scripts/../lib/browserid.php:928 23 | #: ../lib/browserid.php:136 ../lib/browserid.php:928 24 | msgid "Logout" 25 | msgstr "ログアウト" 26 | 27 | #: ../lib/browserid.php:162 scripts/../lib/browserid.php:162 28 | #: ../lib/browserid.php:162 29 | msgid "Settings" 30 | msgstr "設定" 31 | 32 | #: ../lib/browserid.php:267 ../lib/browserid.php:393 33 | #: scripts/../lib/browserid.php:267 scripts/../lib/browserid.php:393 34 | #: ../lib/browserid.php:267 ../lib/browserid.php:393 35 | msgid "Verification failed" 36 | msgstr "認証が失敗しました" 37 | 38 | #: ../lib/browserid.php:386 scripts/../lib/browserid.php:386 39 | #: ../lib/browserid.php:386 40 | msgid "Verification response invalid" 41 | msgstr "認証のレスポンスが正しくありません" 42 | 43 | #: ../lib/browserid.php:460 scripts/../lib/browserid.php:460 44 | #: ../lib/browserid.php:460 45 | msgid "You must already have an account to log in with Persona." 46 | msgstr "あなたは既にPersonaでログインするためのアカウントを持っています。" 47 | 48 | #: ../lib/browserid.php:489 scripts/../lib/browserid.php:489 49 | #: ../lib/browserid.php:489 50 | msgid "ERROR: Your account has been marked as a spammer." 51 | msgstr "エラー: あなたのアカウントはスパマーとしてマークされています。" 52 | 53 | #: ../lib/browserid.php:495 scripts/../lib/browserid.php:495 54 | #: ../lib/browserid.php:495 55 | msgid "Site Suspended." 56 | msgstr "サイトは休止中です。" 57 | 58 | #: ../lib/browserid.php:592 scripts/../lib/browserid.php:592 59 | #: ../lib/browserid.php:592 60 | msgid "Register" 61 | msgstr "登録" 62 | 63 | #: ../lib/browserid.php:624 scripts/../lib/browserid.php:624 64 | #: ../lib/browserid.php:624 65 | #, php-format 66 | msgid "" 67 | "ERROR: %s uses Mozilla Persona for registration. Please " 68 | "register using Persona." 69 | msgstr "エラー: %sは登録にMozilla Personaを使用しています。Personaを使った登録してください。" 70 | 71 | #: ../lib/browserid.php:652 scripts/../lib/browserid.php:652 72 | #: ../lib/browserid.php:652 73 | msgid "Password reset disabled" 74 | msgstr "パスワードリセットは無効です" 75 | 76 | #: ../lib/browserid.php:653 scripts/../lib/browserid.php:653 77 | #: ../lib/browserid.php:653 78 | #, php-format 79 | msgid "" 80 | "%s uses Mozilla Persona to sign in and does not use passwords. Password " 81 | "reset is disabled." 82 | msgstr "%sはサインインにMozilla Personaを利用していますが、パスワードを使用していません。パスワードリセットは無効です。" 83 | 84 | #: ../lib/browserid.php:715 ../lib/browserid.php:717 85 | #: scripts/../lib/browserid.php:715 scripts/../lib/browserid.php:717 86 | #: ../lib/browserid.php:715 ../lib/browserid.php:717 87 | msgid "Comment must be submitted using Persona" 88 | msgstr "コメントを投稿するにはPersonaを利用する必要があります" 89 | 90 | #: ../lib/browserid.php:803 scripts/../lib/browserid.php:803 91 | #: ../lib/browserid.php:803 92 | msgid "What is Persona?" 93 | msgstr "Personaとは何ですか?" 94 | 95 | #: ../lib/browserid.php:855 ../lib/browserid.php:856 96 | #: scripts/../lib/browserid.php:855 scripts/../lib/browserid.php:856 97 | #: ../lib/browserid.php:855 ../lib/browserid.php:856 98 | msgid "Mozilla Persona" 99 | msgstr "Mozilla Persona" 100 | 101 | #: ../lib/browserid.php:855 scripts/../lib/browserid.php:855 102 | #: ../lib/browserid.php:855 103 | msgid "Administration" 104 | msgstr "管理" 105 | 106 | #: ../lib/browserid.php:866 scripts/../lib/browserid.php:866 107 | #: ../lib/browserid.php:866 108 | msgid "Site name:" 109 | msgstr "サイト名:" 110 | 111 | #: ../lib/browserid.php:867 scripts/../lib/browserid.php:867 112 | #: ../lib/browserid.php:867 113 | msgid "Site logo:" 114 | msgstr "サイトロゴ:" 115 | 116 | #: ../lib/browserid.php:868 scripts/../lib/browserid.php:868 117 | #: ../lib/browserid.php:868 118 | msgid "Disable non-Persona logins:" 119 | msgstr "Personaではないログインを無効にする:" 120 | 121 | #: ../lib/browserid.php:869 scripts/../lib/browserid.php:869 122 | #: ../lib/browserid.php:869 123 | msgid "Login button HTML:" 124 | msgstr "ログインボタンのHTML:" 125 | 126 | #: ../lib/browserid.php:870 scripts/../lib/browserid.php:870 127 | #: ../lib/browserid.php:870 128 | msgid "Logout button HTML:" 129 | msgstr "ログアウトボタンのHMTL:" 130 | 131 | #: ../lib/browserid.php:872 scripts/../lib/browserid.php:872 132 | #: ../lib/browserid.php:872 133 | msgid "Login redirection URL:" 134 | msgstr "ログインの際のリダイレクトURL:" 135 | 136 | #: ../lib/browserid.php:873 scripts/../lib/browserid.php:873 137 | #: ../lib/browserid.php:873 138 | msgid "Enable for comments:" 139 | msgstr "コメントを有効にする:" 140 | 141 | #: ../lib/browserid.php:874 scripts/../lib/browserid.php:874 142 | #: ../lib/browserid.php:874 143 | msgid "Enable bbPress integration:" 144 | msgstr "bbPressとの統合を有効にする:" 145 | 146 | #: ../lib/browserid.php:875 scripts/../lib/browserid.php:875 147 | #: ../lib/browserid.php:875 148 | msgid "Persona source:" 149 | msgstr "Personaソース:" 150 | 151 | #: ../lib/browserid.php:876 scripts/../lib/browserid.php:876 152 | #: ../lib/browserid.php:876 153 | msgid "Verification server:" 154 | msgstr "認証サーバー:" 155 | 156 | #: ../lib/browserid.php:877 scripts/../lib/browserid.php:877 157 | #: ../lib/browserid.php:877 158 | msgid "Debug mode:" 159 | msgstr "デバッグモード:" 160 | 161 | #: ../lib/browserid.php:911 scripts/../lib/browserid.php:911 162 | #: ../lib/browserid.php:911 163 | msgid "Absolute path, works only with SSL" 164 | msgstr "絶対パス。SSLでのみ有効" 165 | 166 | #: ../lib/browserid.php:938 scripts/../lib/browserid.php:938 167 | #: ../lib/browserid.php:938 168 | msgid "Default WordPress dashboard" 169 | msgstr "デフォルトWordPressダッシュボード" 170 | 171 | #: ../lib/browserid.php:968 scripts/../lib/browserid.php:968 172 | #: ../lib/browserid.php:968 173 | msgid "Enables anonymous posting implicitly" 174 | msgstr "匿名投稿を暗黙で有効にする" 175 | 176 | #: ../lib/browserid.php:984 ../lib/browserid.php:1005 177 | #: scripts/../lib/browserid.php:984 scripts/../lib/browserid.php:1005 178 | #: ../lib/browserid.php:984 ../lib/browserid.php:1005 179 | msgid "Default" 180 | msgstr "デフォルト" 181 | 182 | #: ../lib/browserid.php:1028 scripts/../lib/browserid.php:1028 183 | #: ../lib/browserid.php:1028 184 | msgid "Security risk!" 185 | msgstr "セキュリティリスク!" 186 | 187 | #: ../lib/browserid.php:1133 scripts/../lib/browserid.php:1133 188 | #: ../lib/browserid.php:1133 189 | msgid "Mozilla Persona login button" 190 | msgstr "Mozilla Personaログインボタン" 191 | 192 | #: ../lib/browserid.php:1208 scripts/../lib/browserid.php:1208 193 | #: ../lib/browserid.php:1208 194 | #, php-format 195 | msgid "New user registration on your site %s:" 196 | msgstr "あなたのサイト %s での新しいユーザーの登録:" 197 | 198 | #: ../lib/browserid.php:1209 ../lib/browserid.php:1217 199 | #: scripts/../lib/browserid.php:1209 scripts/../lib/browserid.php:1217 200 | #: ../lib/browserid.php:1209 ../lib/browserid.php:1217 201 | #, php-format 202 | msgid "Username: %s" 203 | msgstr "ユーザー名: %s" 204 | 205 | #: ../lib/browserid.php:1210 scripts/../lib/browserid.php:1210 206 | #: ../lib/browserid.php:1210 207 | #, php-format 208 | msgid "E-mail: %s" 209 | msgstr "メールアドレス: %s" 210 | 211 | #: ../lib/browserid.php:1212 scripts/../lib/browserid.php:1212 212 | #: ../lib/browserid.php:1212 213 | #, php-format 214 | msgid "[%s] New User Registration" 215 | msgstr "[%s] 新しいユーザーの登録" 216 | 217 | #: ../lib/browserid.php:1226 scripts/../lib/browserid.php:1226 218 | #: ../lib/browserid.php:1226 219 | #, php-format 220 | msgid "%s uses Mozilla Persona to sign in and does not use passwords" 221 | msgstr "%sはサインインにMozilla Personaを使用していますが、パスワードを使用していません" 222 | 223 | #: ../lib/browserid.php:1227 scripts/../lib/browserid.php:1227 224 | #: ../lib/browserid.php:1227 225 | #, php-format 226 | msgid "[%s] Your username" 227 | msgstr "[%s] あなたのユーザ名" 228 | 229 | #: ../lib/browserid.php:1229 scripts/../lib/browserid.php:1229 230 | #: ../lib/browserid.php:1229 231 | #, php-format 232 | msgid "Password: %s" 233 | msgstr "パスワード: %s" 234 | 235 | #: ../lib/browserid.php:1230 scripts/../lib/browserid.php:1230 236 | #: ../lib/browserid.php:1230 237 | #, php-format 238 | msgid "[%s] Your username and password" 239 | msgstr "[%s] あなたのユーザー名とパスワード" 240 | -------------------------------------------------------------------------------- /browserid.min.css: -------------------------------------------------------------------------------- 1 | .persona-button--select-color{line-height:23px}input[type=radio].persona-button--select-color-radio{margin:0 10px 0 0;display:table-cell;vertical-align:middle}.persona-button{color:#fff!important;display:inline-block;font-size:12px;font-weight:bold;line-height:1.1;overflow:hidden;position:relative;text-decoration:none;text-shadow:0 1px rgba(0,0,0,0.5),0 0 2px rgba(0,0,0,0.2);background:#297dc3;background:-moz-linear-gradient(top,#43a6e2,#287cc2);background:-ms-linear-gradient(top,#43a6e2,#287cc2);background:-o-linear-gradient(top,#43a6e2,#287cc2);background:-webkit-linear-gradient(top,#43a6e2,#287cc2);background:linear-gradient(top,#43a6e2,#287cc2);-moz-border-radius:3px;-ms-border-radius:3px;-o-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;-moz-box-shadow:0 1px 0 rgba(0,0,0,0.2);-ms-box-shadow:0 1px 0 rgba(0,0,0,0.2);-o-box-shadow:0 1px 0 rgba(0,0,0,0.2);-webkit-box-shadow:0 1px 0 rgba(0,0,0,0.2);box-shadow:0 1px 0 rgba(0,0,0,0.2)}.persona-button:hover{background:#21669f;background:-moz-linear-gradient(top,#3788b9,#21669f);background:-ms-linear-gradient(top,#3788b9,#21669f);background:-o-linear-gradient(top,#3788b9,#21669f);background:-webkit-linear-gradient(top,#3788b9,#21669f);background:linear-gradient(top,#3788b9,#21669f);color:#fff!important}.persona-button:active,.persona-button:focus{color:#fff!important;top:1px;-moz-box-shadow:none;-ms-box-shadow:none;-o-box-shadow:none;-webkit-box-shadow:none;box-shadow:none}.persona-button.disabled,.persona-button.disabled:hover,.persona-button.disabled:active,.persona-button.disabled:focus{background:#297dc3;background:-moz-linear-gradient(top,#43a6e2,#287cc2);background:-ms-linear-gradient(top,#43a6e2,#287cc2);background:-o-linear-gradient(top,#43a6e2,#287cc2);background:-webkit-linear-gradient(top,#43a6e2,#287cc2);background:linear-gradient(top,#43a6e2,#287cc2);opacity:.5;top:0}.persona-button__text{display:inline-block;padding:5px 10px 5px 40px}.persona-button__text:after{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAPCAYAAAA/I0V3AAAA4klEQVR42o2RWaqEMBRE3YaCiDjPwQGcd9CrysLv4wTyoLFD90dxqbp1EgdPRB7Kskznea6Zn/aPoKoqUUrJOI5m4l2QBfSyLHKep1zXZSae3An1fS/7vst931bGkzuhaZrsLVbGkzuheZ7lOI6HyJ2QUkqv6yrbtv0LT+6E7G0UrfBfP3lZlpoXH4ZBmHgn5Pv+KwxDfqp0XQdgJp6c/RsUBIGOokiSJDE/s21bACbe5Ozp0TdAHMdSFIXUdS1N01C2wpObPT36HifwCJzI0iX29Oh7XP0E3CB9L01TzM+i/wePv4ZE5RtAngAAAABJRU5ErkJggg==) 10px center no-repeat;content:'';display:block;width:31px;position:absolute;bottom:0;left:-3px;top:0;z-index:10}.persona-button__text:before{content:'';display:block;height:100%;width:20px;position:absolute;bottom:0;left:0;top:0;z-index:1;background:#42a9dd;background:-moz-linear-gradient(top,#50b8e8,#3095ce);background:-ms-linear-gradient(top,#50b8e8,#3095ce);background:-o-linear-gradient(top,#50b8e8,#3095ce);background:-webkit-linear-gradient(top,#50b8e8,#3095ce);background:linear-gradient(top,#50b8e8,#3095ce);-moz-border-radius:3px 0 0 3px;-ms-border-radius:3px 0 0 3px;-o-border-radius:3px 0 0 3px;-webkit-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px}.persona-button:before{background:#42a9dd;content:'';display:block;height:26px;width:26px;position:absolute;left:2px;top:50%;margin-top:-13px;z-index:0;background:-moz-linear-gradient(-45deg,#50b8e8,#3095ce);background:-ms-linear-gradient(-45deg,#50b8e8,#3095ce);background:-o-linear-gradient(-45deg,#50b8e8,#3095ce);background:-webkit-linear-gradient(-45deg,#50b8e8,#3095ce);background:linear-gradient(-45deg,#3095ce,#50b8e8);-moz-box-shadow:1px -1px 1px rgba(0,0,0,0.1);-ms-box-shadow:1px -1px 1px rgba(0,0,0,0.1);-o-box-shadow:1px -1px 1px rgba(0,0,0,0.1);-webkit-box-shadow:1px -1px 1px rgba(0,0,0,0.1);box-shadow:1px -1px 1px rgba(0,0,0,0.1);-moz-transform:rotate(45deg);-ms-transform:rotate(45deg);-o-transform:rotate(45deg);-webkit-transform:rotate(45deg);transform:rotate(45deg)}.persona-button:after{content:'';display:block;height:100%;width:100%;position:absolute;left:0;top:0;bottom:0;right:0;z-index:10;-moz-border-radius:3px;-ms-border-radius:3px;-o-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;-moz-box-shadow:inset 0 -1px 0 rgba(0,0,0,0.3);-ms-box-shadow:inset 0 -1px 0 rgba(0,0,0,0.3);-o-box-shadow:inset 0 -1px 0 rgba(0,0,0,0.3);-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,0.3);box-shadow:inset 0 -1px 0 rgba(0,0,0,0.3)}.persona-button.dark{background:#3c3c3c;background:-moz-linear-gradient(top,#606060,#3c3c3c);background:-ms-linear-gradient(top,#606060,#3c3c3c);background:-o-linear-gradient(top,#606060,#3c3c3c);background:-webkit-linear-gradient(top,#606060,#3c3c3c);background:linear-gradient(top,#606060,#3c3c3c)}.persona-button.dark:hover{background:#2d2d2d;background:-moz-linear-gradient(top,#484848,#2d2d2d);background:-ms-linear-gradient(top,#484848,#2d2d2d);background:-o-linear-gradient(top,#484848,#2d2d2d);background:-webkit-linear-gradient(top,#484848,#2d2d2d);background:linear-gradient(top,#484848,#2d2d2d)}.persona-button.dark span:before{background:#d34f2d;background:-moz-linear-gradient(top,#ebac45,#d34f2d);background:-ms-linear-gradient(top,#ebac45,#d34f2d);background:-o-linear-gradient(top,#ebac45,#d34f2d);background:-webkit-linear-gradient(top,#ebac45,#d34f2d);background:linear-gradient(top,#ebac45,#d34f2d)}.persona-button.dark:before{background:#d34f2d;background:-moz-linear-gradient(-45deg,#ebac45,#d34f2d);background:-ms-linear-gradient(-45deg,#ebac45,#d34f2d);background:-o-linear-gradient(-45deg,#ebac45,#d34f2d);background:-webkit-linear-gradient(-45deg,#ebac45,#d34f2d);background:linear-gradient(-45deg,#d34f2d,#ebac45)}.persona-button.orange{background:#ee731a;background:-moz-linear-gradient(top,#ee731a,#d03116);background:-ms-linear-gradient(top,#ee731a,#d03116);background:-o-linear-gradient(top,#ee731a,#d03116);background:-webkit-linear-gradient(top,#ee731a,#d03116);background:linear-gradient(top,#ee731a,#d03116)}.persona-button.orange:hover{background:#cb6216;background:-moz-linear-gradient(top,#cb6216,#b12a13);background:-ms-linear-gradient(top,#cb6216,#b12a13);background:-o-linear-gradient(top,#cb6216,#b12a13);background:-webkit-linear-gradient(top,#cb6216,#b12a13);background:linear-gradient(top,#cb6216,#b12a13)}.persona-button.orange span:before{background:#e84a21;background:-moz-linear-gradient(top,#f7ad27,#e84a21);background:-ms-linear-gradient(top,#f7ad27,#e84a21);background:-o-linear-gradient(top,#f7ad27,#e84a21);background:-webkit-linear-gradient(top,#f7ad27,#e84a21);background:linear-gradient(top,#f7ad27,#e84a21)}.persona-button.orange:before{background:#e84a21;background:-moz-linear-gradient(-45deg,#f7ad27,#e84a21);background:-ms-linear-gradient(-45deg,#f7ad27,#e84a21);background:-o-linear-gradient(-45deg,#f7ad27,#e84a21);background:-webkit-linear-gradient(-45deg,#f7ad27,#e84a21);background:linear-gradient(-45deg,#e84a21,#f7ad27)}.persona__whatis{font-size:10px!important;margin:5px 0 0 0!important;line-height:1!important}.persona__whatis_link{margin:0!important;color:#757575!important}.persona__error{padding:12px;background-color:#ffebe8;color:#333;border:1px solid #c00;font-size:12px}.persona__error-login{margin:10px;vertical-align:top}.persona__error-comment{display:inline-block}.persona__warning{padding:12px;background-color:#ffebe8;color:#333;border:1px solid #c00;font-size:12px}.persona__warning-heading{display:inline-block}.persona--persona-only-auth.login-action-register .user_email,.persona--persona-only-auth.login-action-register [for=user_email],.persona--persona-only-auth.login-action-register #reg_passmail{display:none}.persona--persona-only-auth #wp-submit{position:absolute;left:-9999px!important}.persona--comments #respond input[type=submit]{position:absolute;left:-9999px!important}.persona--persona-only-auth.login-action-login #user_login,.persona--persona-only-auth.login-action-login [for=user_login],.persona--persona-only-auth.login-action-login #user_pass,.persona--persona-only-auth.login-action-login [for=user_pass],.persona--persona-only-auth.login-action-login [name=log],.persona--persona-only-auth.login-action-login [name=pwd]{display:none}.persona__submit{position:absolute;position:fixed;top:0;left:0;right:0;bottom:0;background-color:#fff;background-color:rgba(255,255,255,.7);z-index:1000}@-webkit-keyframes spin{from{-webkit-transform:rotate(0deg)}to{-webkit-transform:rotate(365deg)}}@-moz-keyframes spin{from{-moz-transform:rotate(0deg)}to{-moz-transform:rotate(365deg)}}@keyframes spin{from{transform:rotate(0deg)}to{transform:rotate(365deg)}}.persona__submit_spinner{background-image:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAACC9JREFUeNrMWluMFEUUrdvz2DePXUEXlIeK+ADBiIqJoBJN1PhjVDAS/4zGV2KMH2o0fuivmphgQGPij8ag8qUmJpCYmOAmJqKofICIJiACLrqww+zOTHd5btetmZpmeqanZxbpyZ2q7umuvqfuo+69NbRg+5iKO7SQ7Qe2g6/ob6A5aG5B51r0l4EW4vwStINofbk3g7aMe46hPY7z/Wj3ov0W7a/KGbPZUXxo7VnXsqqzYwB0H2gjKXUrmJiV8LmlDeaMZ3QL6MM0jKQFMgx6Esw/Aw7mN7qB4mZXn31dm9tvFroG9FK7DHkpQDyO97IavKYEBEURJDxi1OhFXF+lHdWOUkdAMMAK8LgHtBWncxvxTe1jiQO2ZkYkghc8AeZ+Qne15ZJSs5tAOlqdUG2KJAmQt8DyO41m3AVDDWzDgVoGTSdRL5wfQLOz28b+Keh+l8GwjViy+xtc9DEiNaa1+g7XfsC1v9H+g58qopLspleAbgKtjXiwgxjoYbRn2gZCMRoCRrYxiOgMV/sU3hNKhVcVnO4CiK1ov8DlYov37pLZz6FZrw2YE6CvQROp3C81FvXLoMfkN19UkLSjLroG5it0n8P5vhTvL1tQnR6NVOsedq3CZFlAnKX26JxkJ4DudnUeHFEgfWDwTZnxKYDxAEZTTQieNoLYg/ZetH9qdX4cWa9erV4HLedwRuxBg+uATQB9j4xExtC/E+2kOo8OVyIcGjxNxrv4MvOhFkEk3M+xJ8L5OvFA5/RgXiqaSbdcR57HzXkyM83qFJAJeH20PaxGQLPp/wIxFWjVA26X92Waeq3VoM3AWpIHAwnkGEyPzMGz6B/KOG6upJOF3d0AkYNirx3MqoU5L0YiFN69Ed85dCesJIR49llKO9B+En2Y54YNR88wiDxesmEopy6ERZ/ydaxEGOJdquaafDZuMewByafeaLRusnR43GlZbLoPgmeX1O2zcuoCcBoHwgK5Ee2loFPa2IOnqTrJvXBXn6PdHTcAi9HDy85g5vwOIt84SawfyqoRAdFsbNaMVWhngwqiTr5nKFw/wOPHoXhiiG9iyQzgy1Odq1nVJsiAmA91Ot0ChHW/l4l3quj6IHYAX79LCpooH5gFMAUwUQrSA7GGfduQUafTgU4kZTxCF4FvRJsUiCRYvZj6Qb+ADpIga0UZAdMP8nV7UtBVF8uGnVXzAGIyIQgrkREy9hrYuJBqAd3+dpMjHoFnoIRgphgYtWsGgIU3FZZotLoca8QKUC8ll4Rr7Hlt3GxFBrcTzEB+S6MerGZzMx7aIATj16cHVTsq4YSBzMfasDSfUYt6zGJXaBOEzUfKZN4VOPkRCbhUthvIIMMwVFYPd3YtkDK+RvD7MjA/CtfHxl0MdPXZNLFWIMuAG3qwepVtTS5tDj6Nr7lgdgm7QEmMLfliT8MZYwtliaHSuu+skzz5EfX10wKxD42Ehl+zExdIWEeA3CeD7kQGWcmPA6taVM/PwjSSoNBGAMIzK3+lgYcLpH5KXQpxWCLHHQlUy7wSZy1uVxL88JDHIYGxAxvrxHmtbhWVeGU/SgZQRcgX4z+FdgloUZI1xHqr2aEkqGWsb/OLcvsLP8V5ykOOtH0HzASuLsCMrmwWopAMzXYwG9PBOUOQkCO+j2O0iq6v/reozXlxEtlHXIsyrtjHG3wyxICmQHc0k4SWFX3AM7FW0OaKHoYl8FhsSwmqhRkdKxFSP4LpA6Beq16qJhUurN1Apu7bEATrZL+XPmC0XE1r44IpXho2CvLiVIvv+0aZdLZiI2ABM8kZIvoPNAKSB/oeWR+CTgzVFrnYZrhs0+Aj0vDiklLPM0ztFO/V4xq9eLLj6G8ArXNBeDYro5rL7TR8V6oWTkTGAwCd1wkmg4PDL/HwkIzlGj6XhooY+VEIYB4nUWxMWY+a7XF0BChce7Sxt1DbtOq12HQT92tn+SM042SSvqobFsM/if4ol0a76PqTHn3alKJ0GKip1uWgP8DhZ8psq/lVD1aLxbDe0Gqcv6pM8flcHIOcFehahkA6JjD2Iova+wCwF8TlfxsVAwwJqSNSOnpBGzWcyWOO7AjbzWRquiBGFjdeaLdwXkTKumOyGaO1myO470q0r+B85QwAYHsYlR3iQNenFm3tIe4BvafMbJAYv3XHFceT8YueAj0CmtelAHYUnC4Gs33yHgugpV1mY+7YAUkwo5vx+2FlJGSCSaqWUifkWd51ulqZjf/vFe86JS+rklRwRlhVyTBdEJW26uRJ5VNJDY5igMSC/UAWw7t5+4zDorAyLyG/rbyQkQ6vuNdJIfyw0FFldqGmVK2GlxdHMSgA+lmVtCy+WnYBgMCTwrl18SQgdTsbPe6xjQwzm2TUCae4bdswGcR8FERqI1LQuEqyzLJsQZQESCCMlyWJnJTih1buzpiu7gLIghiKoqhiNlVb/vMBA+yAbP9iWyDjmk+IJOrASIzEJaWCk13aCCErTHLdu2TjOem7jNrZtxtKfJ6Rd5wR6aaSiD12kwn3HyTjqU5zvhKN62R/VHlyLsxpJ5UOmrjQ6PWM+CsGMKFapC7t/POBE7C30X0X7bgyW819yu5qRcAo1egPRDWGQ0PW4fs9XQs/+DynjQqGqoyL4ypB/pXmTzW8a/UzaA3efj3aBaJCPHNFC8ZtY2bfs7GnYx9lkfQ4781TGwlk2n8HFSX0H4M0eM/xCgZExhMNyu/W0KvrkOi7tZm8SGFa8p6TykTg42l2KTr9v1ZZpMPErvpiWRyHZYXuk2TIgtHyTEE8GQP4V6jYCSP/CTAAr5kcJEeom/4AAAAASUVORK5CYII=');display:block;top:30%;left:50%;margin:-25px 0 0 -50px;width:50px;height:50px;position:absolute;-webkit-animation:.9s spin infinite linear;-moz-animation:.9s spin infinite linear;animation:.9s spin infinite linear}.persona__widget-button-container{list-style-type:none} -------------------------------------------------------------------------------- /browserid.php: -------------------------------------------------------------------------------- 1 | options = new MozillaPersonaOptions(); 70 | $this->options->Init(); 71 | 72 | $this->activation = new MozillaPersonaPluginActivation(array( 73 | 'plugin_options' => $this->options, 74 | 'file' => __FILE__ 75 | )); 76 | 77 | // Register actions & filters 78 | add_action('init', array(&$this, 'Init'), 0); 79 | 80 | // frontend 81 | add_action('wp_enqueue_scripts', 82 | array(&$this, 'Add_external_dependencies')); 83 | 84 | // login screen 85 | add_action('login_enqueue_scripts', 86 | array(&$this, 'Add_external_dependencies')); 87 | 88 | // admin pages 89 | add_action('admin_enqueue_scripts', 90 | array(&$this, 'Add_external_dependencies')); 91 | add_action('admin_enqueue_scripts', 92 | array(&$this, 'Add_external_dependencies_settings')); 93 | add_action('admin_print_styles-settings_page_browserid-wordpress', 94 | array(&$this, 'Add_external_dependencies_settings')); 95 | } 96 | 97 | // Initialization 98 | function Init() { 99 | $this->Init_l10n(); 100 | 101 | $this->Init_comments(); 102 | $this->Init_login(); 103 | $this->Init_registration(); 104 | $this->Init_bbpress(); 105 | $this->Init_verifier(); 106 | $this->Init_assertion_handler(); 107 | 108 | if ($this->assertion_handler->Handle_assertion()) return; 109 | 110 | $this->Init_administration(); 111 | $this->Init_shortcode(); 112 | $this->Init_widget(); 113 | $this->Init_lostpassword(); 114 | 115 | $this->Set_error_from_request(); 116 | } 117 | 118 | private function Init_comments() { 119 | $this->comments = new MozillaPersonaComments(array( 120 | 'is_comments_enabled' => $this->options->Is_comments(), 121 | 'is_bbpress_enabled' => $this->options->Is_bbpress(), 122 | 'ui' => $this, 123 | 'button_html' => $this->options->Get_comment_html() 124 | )); 125 | $this->comments->Init(); 126 | } 127 | 128 | private function Init_login() { 129 | $this->login = new MozillaPersonaLogin(array( 130 | 'is_browserid_only_auth' => $this->options->Is_browserid_only_auth(), 131 | 'ui' => $this, 132 | 'option_redirect_url' => $this->options->Get_login_redir(), 133 | 'request_redirect_url' => $this->Get_request_redirect_url(), 134 | 'login_html' => $this->options->Get_login_html(), 135 | 'logout_html' => $this->options->Get_logout_html() 136 | )); 137 | $this->login->Init(); 138 | } 139 | 140 | private function Init_verifier() { 141 | $this->verifier = new MozillaPersonaVerifier(array( 142 | 'vserver' => $this->options->Get_vserver(), 143 | 'audience' => $this->options->Get_audience(), 144 | 'ui' => $this, 145 | 'is_debug' => $this->options->Is_debug(), 146 | 'rememberme' => $this->login->Get_rememberme() 147 | )); 148 | $this->verifier->Init(); 149 | } 150 | 151 | private function Init_registration() { 152 | $this->registration = new MozillaPersonaRegistration(array( 153 | 'login' => $this->login, 154 | 'browserid_only_auth' => $this->options->Is_browserid_only_auth(), 155 | 'ui' => $this 156 | )); 157 | $this->registration->Init(); 158 | } 159 | 160 | private function Init_bbpress() { 161 | $this->bbpress = new MozillaPersonaBbPress(array( 162 | 'is_bbpress_enabled' => $this->options->Is_bbpress(), 163 | 'comments' => $this->comments 164 | )); 165 | $this->bbpress->Init(); 166 | } 167 | 168 | private function Init_lostpassword() { 169 | $this->lostpassword = new MozillaPersonaLostPassword(array( 170 | 'browserid_only_auth' => $this->options->Is_browserid_only_auth(), 171 | 'ui' => $this 172 | )); 173 | $this->lostpassword->Init(); 174 | } 175 | 176 | private function Init_administration() { 177 | $this->administration = new MozillaPersonaAdministration(array( 178 | 'logged_in_user' => $this->login->Get_browserid_logged_in_user(), 179 | 'browserid_only_auth' => $this->options->Is_browserid_only_auth(), 180 | 'audience' => $this->options->Get_audience(), 181 | 'is_debug' => $this->options->Is_debug(), 182 | 'ui' => $this, 183 | 'logout_html' => $this->options->Get_logout_html() 184 | )); 185 | $this->administration->Init(); 186 | } 187 | 188 | private function Init_shortcode() { 189 | $this->shortcode = new MozillaPersonaShortcode(array( 190 | 'ui' => $this 191 | )); 192 | $this->shortcode->Init(); 193 | } 194 | 195 | private function Init_assertion_handler() { 196 | $this->assertion_handler = new MozillaPersonaAssertionHandler(array( 197 | 'login' => $this->login, 198 | 'comments' => $this->comments, 199 | 'registration' => $this->registration, 200 | 'verifier' => $this->verifier 201 | )); 202 | $this->assertion_handler->Init(); 203 | } 204 | 205 | private function Init_widget() { 206 | $this->widget = new MozillaPersonaWidget(); 207 | $this->widget->Init(); 208 | } 209 | 210 | private function Init_l10n() { 211 | $l10npath = dirname(plugin_basename(__FILE__)) . '/languages/'; 212 | load_plugin_textdomain(c_bid_text_domain, false, $l10npath); 213 | } 214 | 215 | // Add external dependencies - both JS & CSS 216 | public function Add_external_dependencies() { 217 | // Add the Persona button styles. 218 | wp_enqueue_style('persona-style', 219 | $this->CssUrl('browserid'), 220 | array(), c_bid_version); 221 | 222 | wp_register_script('browserid', 223 | $this->options->Get_persona_source() . '/include.js', 224 | array(), c_bid_version, true); 225 | 226 | // This one script takes care of all work. 227 | wp_enqueue_script('browserid_common', 228 | $this->JavascriptUrl('browserid'), 229 | array('jquery', 'browserid'), c_bid_version, true); 230 | 231 | $data_array = array( 232 | 'urlLoginSubmit' 233 | => get_site_url(null, '/'), 234 | 'urlLoginRedirect' 235 | => $this->login->Get_login_redirect_url(), 236 | 'urlRegistrationRedirect' 237 | => $this->registration->Get_registration_redirect_url(), 238 | 'urlLogoutRedirect' 239 | => wp_logout_url(), 240 | 'msgError' 241 | => $this->Get_error_message(), 242 | 'msgFailed' 243 | => $this->verifier->Get_verification_failed_message(), 244 | 'isPersonaOnlyAuth' 245 | => $this->options->Is_browserid_only_auth(), 246 | 'isPersonaUsedWithComments' 247 | => $this->options->Is_comments() && 248 | ! is_user_logged_in(), 249 | 250 | // From here down is passed to the Persona dialog. 251 | 'siteName' 252 | => $this->options->Get_sitename(), 253 | 'siteLogo' 254 | => $this->options->Get_sitelogo(), 255 | 'backgroundColor' 256 | => $this->options->Get_background_color(), 257 | 'termsOfService' 258 | => $this->options->Get_terms_of_service(), 259 | 'privacyPolicy' 260 | => $this->options->Get_privacy_policy(), 261 | 'loggedInUser' 262 | => $this->login->Get_browserid_logged_in_user(), 263 | ); 264 | 265 | /** 266 | * wp_localize_script calls json_encode which escapes all of the 267 | * URLs and replaces any / with \/. This messes with certain servers 268 | * that do not normalize the extra \ and refuse to serve the 269 | * siteLogo. 270 | * To avoid the double escaping, manually write out the script, 271 | * replacing any \/ with /. 272 | * All parameters passed to Persona will be properly escaped. 273 | * See issue #47 274 | * https://github.com/shane-tomlinson/browserid-wordpress/issues/47 275 | */ 276 | $encoded_browserid_common = str_replace('\\/', '/', 277 | json_encode( $data_array) ); 278 | ?> 279 | 282 | JavascriptUrl('browserid-settings'), 293 | array('jquery', 'wp-color-picker'), c_bid_version, true); 294 | } 295 | 296 | private function JavascriptUrl($root_name) { 297 | $file_name = $root_name; 298 | if (! $this->options->Use_uncompressed_resources()) 299 | $file_name .= '.min'; 300 | 301 | $file_name .= ".js"; 302 | return plugins_url($file_name, __FILE__); 303 | } 304 | 305 | private function CssUrl($root_name) { 306 | $file_name = $root_name; 307 | if (! $this->options->Use_uncompressed_resources()) 308 | $file_name .= '.min'; 309 | 310 | $file_name .= ".css"; 311 | return plugins_url($file_name, __FILE__); 312 | } 313 | 314 | private function Set_error_from_request() { 315 | // On the login pages, if there is an error, surface it to be 316 | // printed into the templates. 317 | if (isset($_REQUEST['browserid_error'])) { 318 | global $error; 319 | $error = $_REQUEST['browserid_error']; 320 | } 321 | } 322 | 323 | // Get the error message 324 | function Get_error_message() { 325 | return (isset($_REQUEST['browserid_error']) ? $_REQUEST['browserid_error'] : null); 326 | } 327 | 328 | 329 | function Handle_error($message, $debug_message = '', $result = '') { 330 | if ($this->options->Is_debug() && !empty($debug_message)) { 331 | header('Content-type: text/plain'); 332 | echo $debug_message . PHP_EOL; 333 | 334 | if (!empty($result)) { 335 | print_r($result); 336 | } 337 | } else { 338 | // XXX I don't understand this. 339 | $post_id = $this->comments->Is_comment(); 340 | $redirect = $this->Get_request_redirect_url(); 341 | $url = ($post_id ? get_permalink($post_id) : wp_login_url($redirect)); 342 | $url .= (strpos($url, '?') === false ? '?' : '&') . 'browserid_error=' . urlencode($message); 343 | if ($post_id) 344 | $url .= '#browserid_' . $post_id; 345 | wp_redirect($url); 346 | } 347 | 348 | exit(); 349 | } 350 | 351 | // Print a persona error. 352 | function Print_persona_error($error, $classname = '') { 353 | echo $this->Get_persona_error_html($error, $classname); 354 | } 355 | 356 | // Get html for a Persona error 357 | function Get_persona_error_html($error, $classname = '') { 358 | $error = htmlspecialchars(stripslashes($error), 359 | ENT_QUOTES, get_bloginfo('charset')); 360 | 361 | $html = sprintf('
%s
', $classname, $error); 362 | return $html; 363 | } 364 | 365 | 366 | // Get the Persona Button HTML 367 | function Get_persona_button_html($classname, $html) { 368 | $button_html = '' 369 | . '' 370 | . '%s' 371 | . ' %s'; 372 | 373 | $color = $this->options->Get_button_color(); 374 | $button_html = sprintf($button_html, 375 | "Mozilla Persona", 376 | "persona-button " . $color, 377 | $classname, 378 | "persona-button__text", 379 | $html, 380 | $this->What_is()); 381 | 382 | return $button_html; 383 | } 384 | 385 | // Print a Persona button 386 | function Print_persona_button_html($classname, $html) { 387 | echo $this->Get_persona_button_html($classname, $html); 388 | } 389 | 390 | function What_is() { 391 | $html = '

%s

'; 392 | 393 | $html = sprintf($html, 394 | "https://login.persona.org", 395 | "persona__whatis_link", 396 | __('What is Persona?', c_bid_text_domain) 397 | ); 398 | 399 | return $html; 400 | } 401 | 402 | 403 | 404 | // Build HTML for login/out button/link 405 | function Get_loginout_html($check_login = true) { 406 | return $this->login->Get_loginout_html(); 407 | } 408 | 409 | function Get_assertion() { 410 | return $this->assertion_handler->Get_assertion(); 411 | } 412 | 413 | // Get the redirect URL from the request 414 | function Get_request_redirect_url() { 415 | return (isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : null); 416 | } 417 | 418 | 419 | 420 | // Check environment 421 | function Check_prerequisites() { 422 | // Check WordPress version 423 | global $wp_version; 424 | if (version_compare($wp_version, '3.1') < 0) 425 | die('Mozilla Persona requires at least WordPress 3.1'); 426 | 427 | // Check basic prerequisities 428 | self::Check_function('add_action'); 429 | self::Check_function('wp_enqueue_script'); 430 | self::Check_function('json_decode'); 431 | self::Check_function('parse_url'); 432 | self::Check_function('md5'); 433 | self::Check_function('wp_remote_post'); 434 | self::Check_function('wp_remote_get'); 435 | } 436 | 437 | function Check_function($name) { 438 | if (!function_exists($name)) 439 | die('Required WordPress function "' . $name . '" does not exist'); 440 | } 441 | } 442 | } 443 | 444 | // Start plugin 445 | global $persona_plugin; 446 | if (empty($persona_plugin)) { 447 | $persona_plugin = new MozillaPersona(); 448 | // Check pre-requisites 449 | $persona_plugin->Check_prerequisites(); 450 | 451 | } 452 | 453 | // Template tag "mozilla_persona" 454 | if (!function_exists('mozilla_persona')) { 455 | function mozilla_persona() { 456 | global $persona_plugin; 457 | echo $persona_plugin->Get_loginout_html(); 458 | } 459 | } 460 | 461 | // Template tag "browserid_loginout" 462 | if (!function_exists('browserid_loginout')) { 463 | function browserid_loginout() { 464 | global $persona_plugin; 465 | echo $persona_plugin->Get_loginout_html(); 466 | } 467 | } 468 | ?> 469 | -------------------------------------------------------------------------------- /browserid.css: -------------------------------------------------------------------------------- 1 | 2 | .persona-button--select-color { 3 | line-height: 23px; 4 | } 5 | 6 | input[type=radio].persona-button--select-color-radio { 7 | margin: 0 10px 0 0; 8 | display: table-cell; 9 | vertical-align: middle; 10 | } 11 | 12 | /* Link body */ 13 | .persona-button { 14 | color: #fff !important; 15 | display: inline-block; 16 | font-size: 12px; 17 | font-weight: bold; 18 | line-height: 1.1; 19 | overflow: hidden; 20 | position: relative; 21 | text-decoration: none; 22 | text-shadow: 0 1px rgba(0,0,0,0.5), 0 0 2px rgba(0,0,0,0.2); 23 | 24 | background: #297dc3; 25 | background: -moz-linear-gradient(top, #43a6e2, #287cc2); 26 | background: -ms-linear-gradient(top, #43a6e2, #287cc2); 27 | background: -o-linear-gradient(top, #43a6e2, #287cc2); 28 | background: -webkit-linear-gradient(top, #43a6e2, #287cc2); 29 | background: linear-gradient(top, #43a6e2, #287cc2); 30 | 31 | -moz-border-radius: 3px; 32 | -ms-border-radius: 3px; 33 | -o-border-radius: 3px; 34 | -webkit-border-radius: 3px; 35 | border-radius: 3px; 36 | 37 | -moz-box-shadow: 0 1px 0 rgba(0,0,0,0.2); 38 | -ms-box-shadow: 0 1px 0 rgba(0,0,0,0.2); 39 | -o-box-shadow: 0 1px 0 rgba(0,0,0,0.2); 40 | -webkit-box-shadow: 0 1px 0 rgba(0,0,0,0.2); 41 | box-shadow: 0 1px 0 rgba(0,0,0,0.2); 42 | } 43 | 44 | .persona-button:hover { 45 | background: #21669f; 46 | background: -moz-linear-gradient(top, #3788b9, #21669f); 47 | background: -ms-linear-gradient(top, #3788b9, #21669f); 48 | background: -o-linear-gradient(top, #3788b9, #21669f); 49 | background: -webkit-linear-gradient(top, #3788b9, #21669f); 50 | background: linear-gradient(top, #3788b9, #21669f); 51 | color: #fff !important; 52 | } 53 | 54 | .persona-button:active, .persona-button:focus { 55 | color: #fff !important; 56 | top: 1px; 57 | -moz-box-shadow: none; 58 | -ms-box-shadow: none; 59 | -o-box-shadow: none; 60 | -webkit-box-shadow: none; 61 | box-shadow: none; 62 | } 63 | 64 | .persona-button.disabled, .persona-button.disabled:hover, 65 | .persona-button.disabled:active, .persona-button.disabled:focus{ 66 | background: #297dc3; 67 | background: -moz-linear-gradient(top, #43a6e2, #287cc2); 68 | background: -ms-linear-gradient(top, #43a6e2, #287cc2); 69 | background: -o-linear-gradient(top, #43a6e2, #287cc2); 70 | background: -webkit-linear-gradient(top, #43a6e2, #287cc2); 71 | background: linear-gradient(top, #43a6e2, #287cc2); 72 | opacity: 0.5; 73 | top: 0; 74 | } 75 | 76 | .persona-button__text { 77 | display: inline-block; 78 | padding: 5px 10px 5px 40px; 79 | } 80 | 81 | /* Icon */ 82 | .persona-button__text:after{ 83 | background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAPCAYAAAA/I0V3AAAA4klEQVR42o2RWaqEMBRE3YaCiDjPwQGcd9CrysLv4wTyoLFD90dxqbp1EgdPRB7Kskznea6Zn/aPoKoqUUrJOI5m4l2QBfSyLHKep1zXZSae3An1fS/7vst931bGkzuhaZrsLVbGkzuheZ7lOI6HyJ2QUkqv6yrbtv0LT+6E7G0UrfBfP3lZlpoXH4ZBmHgn5Pv+KwxDfqp0XQdgJp6c/RsUBIGOokiSJDE/s21bACbe5Ozp0TdAHMdSFIXUdS1N01C2wpObPT36HifwCJzI0iX29Oh7XP0E3CB9L01TzM+i/wePv4ZE5RtAngAAAABJRU5ErkJggg==) 10px center no-repeat; 84 | content: ''; 85 | display: block; 86 | width: 31px; 87 | 88 | position: absolute; 89 | bottom: 0; 90 | left: -3px; 91 | top: 0; 92 | z-index: 10; 93 | } 94 | 95 | /* Icon background */ 96 | .persona-button__text:before{ 97 | content: ''; 98 | display: block; 99 | height: 100%; 100 | width: 20px; 101 | 102 | position: absolute; 103 | bottom: 0; 104 | left: 0; 105 | top: 0; 106 | z-index: 1; 107 | 108 | background: #42a9dd; 109 | background: -moz-linear-gradient(top, #50b8e8, #3095ce); 110 | background: -ms-linear-gradient(top, #50b8e8, #3095ce); 111 | background: -o-linear-gradient(top, #50b8e8, #3095ce); 112 | background: -webkit-linear-gradient(top, #50b8e8, #3095ce); 113 | background: linear-gradient(top, #50b8e8, #3095ce); 114 | 115 | -moz-border-radius: 3px 0 0 3px; 116 | -ms-border-radius: 3px 0 0 3px; 117 | -o-border-radius: 3px 0 0 3px; 118 | -webkit-border-radius: 3px 0 0 3px; 119 | border-radius: 3px 0 0 3px; 120 | } 121 | 122 | /* Triangle */ 123 | .persona-button:before{ 124 | background: #42a9dd; 125 | content: ''; 126 | display: block; 127 | height: 26px; 128 | width: 26px; 129 | 130 | position: absolute; 131 | left: 2px; 132 | top: 50%; 133 | margin-top: -13px; 134 | z-index: 0; 135 | 136 | background: -moz-linear-gradient(-45deg, #50b8e8, #3095ce); 137 | background: -ms-linear-gradient(-45deg, #50b8e8, #3095ce); 138 | background: -o-linear-gradient(-45deg, #50b8e8, #3095ce); 139 | background: -webkit-linear-gradient(-45deg, #50b8e8, #3095ce); 140 | background: linear-gradient(-45deg, #3095ce, #50b8e8); /* flipped for updated spec */ 141 | 142 | -moz-box-shadow: 1px -1px 1px rgba(0,0,0,0.1); 143 | -ms-box-shadow: 1px -1px 1px rgba(0,0,0,0.1); 144 | -o-box-shadow: 1px -1px 1px rgba(0,0,0,0.1); 145 | -webkit-box-shadow: 1px -1px 1px rgba(0,0,0,0.1); 146 | box-shadow: 1px -1px 1px rgba(0,0,0,0.1); 147 | 148 | -moz-transform: rotate(45deg); 149 | -ms-transform: rotate(45deg); 150 | -o-transform: rotate(45deg); 151 | -webkit-transform: rotate(45deg); 152 | transform: rotate(45deg); 153 | } 154 | 155 | /* Inset shadow (required here because the icon background clips it when on the `a` element) */ 156 | .persona-button:after{ 157 | content: ''; 158 | display: block; 159 | height: 100%; 160 | width: 100%; 161 | 162 | position: absolute; 163 | left: 0; 164 | top: 0; 165 | bottom: 0; 166 | right: 0; 167 | z-index: 10; 168 | 169 | -moz-border-radius: 3px; 170 | -ms-border-radius: 3px; 171 | -o-border-radius: 3px; 172 | -webkit-border-radius: 3px; 173 | border-radius: 3px; 174 | 175 | -moz-box-shadow: inset 0 -1px 0 rgba(0,0,0,0.3); 176 | -ms-box-shadow: inset 0 -1px 0 rgba(0,0,0,0.3); 177 | -o-box-shadow: inset 0 -1px 0 rgba(0,0,0,0.3); 178 | -webkit-box-shadow: inset 0 -1px 0 rgba(0,0,0,0.3); 179 | box-shadow: inset 0 -1px 0 rgba(0,0,0,0.3); 180 | } 181 | 182 | 183 | 184 | /* ======================================================== 185 | * Dark button 186 | * ===================================================== */ 187 | .persona-button.dark{ 188 | background: #3c3c3c; 189 | background: -moz-linear-gradient(top, #606060, #3c3c3c); 190 | background: -ms-linear-gradient(top, #606060, #3c3c3c); 191 | background: -o-linear-gradient(top, #606060, #3c3c3c); 192 | background: -webkit-linear-gradient(top, #606060, #3c3c3c); 193 | background: linear-gradient(top, #606060, #3c3c3c); 194 | } 195 | .persona-button.dark:hover{ 196 | background: #2d2d2d; 197 | background: -moz-linear-gradient(top, #484848, #2d2d2d); 198 | background: -ms-linear-gradient(top, #484848, #2d2d2d); 199 | background: -o-linear-gradient(top, #484848, #2d2d2d); 200 | background: -webkit-linear-gradient(top, #484848, #2d2d2d); 201 | background: linear-gradient(top, #484848, #2d2d2d); 202 | } 203 | .persona-button.dark span:before{ /* Icon BG */ 204 | background: #d34f2d; 205 | background: -moz-linear-gradient(top, #ebac45, #d34f2d); 206 | background: -ms-linear-gradient(top, #ebac45, #d34f2d); 207 | background: -o-linear-gradient(top, #ebac45, #d34f2d); 208 | background: -webkit-linear-gradient(top, #ebac45, #d34f2d); 209 | background: linear-gradient(top, #ebac45, #d34f2d); 210 | } 211 | .persona-button.dark:before{ /* Triangle */ 212 | background: #d34f2d; 213 | background: -moz-linear-gradient(-45deg, #ebac45, #d34f2d); 214 | background: -ms-linear-gradient(-45deg, #ebac45, #d34f2d); 215 | background: -o-linear-gradient(-45deg, #ebac45, #d34f2d); 216 | background: -webkit-linear-gradient(-45deg, #ebac45, #d34f2d); 217 | background: linear-gradient(-45deg, #d34f2d, #ebac45); /* flipped for updated spec */ 218 | } 219 | 220 | /* ======================================================== 221 | * Orange button 222 | * ===================================================== */ 223 | .persona-button.orange{ 224 | background: #ee731a; 225 | background: -moz-linear-gradient(top, #ee731a, #d03116); 226 | background: -ms-linear-gradient(top, #ee731a, #d03116); 227 | background: -o-linear-gradient(top, #ee731a, #d03116); 228 | background: -webkit-linear-gradient(top, #ee731a, #d03116); 229 | background: linear-gradient(top, #ee731a, #d03116); 230 | } 231 | .persona-button.orange:hover{ 232 | background: #cb6216; 233 | background: -moz-linear-gradient(top, #cb6216, #b12a13); 234 | background: -ms-linear-gradient(top, #cb6216, #b12a13); 235 | background: -o-linear-gradient(top, #cb6216, #b12a13); 236 | background: -webkit-linear-gradient(top, #cb6216, #b12a13); 237 | background: linear-gradient(top, #cb6216, #b12a13); 238 | } 239 | .persona-button.orange span:before{ /* Icon BG */ 240 | background: #e84a21; 241 | background: -moz-linear-gradient(top, #f7ad27, #e84a21); 242 | background: -ms-linear-gradient(top, #f7ad27, #e84a21); 243 | background: -o-linear-gradient(top, #f7ad27, #e84a21); 244 | background: -webkit-linear-gradient(top, #f7ad27, #e84a21); 245 | background: linear-gradient(top, #f7ad27, #e84a21); 246 | } 247 | .persona-button.orange:before{ /* Triangle */ 248 | background: #e84a21; 249 | background: -moz-linear-gradient(-45deg, #f7ad27, #e84a21); 250 | background: -ms-linear-gradient(-45deg, #f7ad27, #e84a21); 251 | background: -o-linear-gradient(-45deg, #f7ad27, #e84a21); 252 | background: -webkit-linear-gradient(-45deg, #f7ad27, #e84a21); 253 | background: linear-gradient(-45deg, #e84a21, #f7ad27); /* flipped for updated spec */ 254 | } 255 | 256 | .persona__whatis { 257 | font-size: 10px !important; 258 | margin: 5px 0 0 0 !important; 259 | line-height: 1 !important; 260 | } 261 | 262 | .persona__whatis_link { 263 | margin: 0 !important; 264 | color: #757575 !important; 265 | } 266 | 267 | .persona__error { 268 | padding: 12px; 269 | background-color: #ffebe8; 270 | color: #333; 271 | border: 1px solid #cc0000; 272 | font-size: 12px; 273 | } 274 | 275 | .persona__error-login { 276 | margin: 10px; 277 | vertical-align: top; 278 | } 279 | 280 | .persona__error-comment { 281 | display: inline-block; 282 | } 283 | 284 | .persona__warning { 285 | padding: 12px; 286 | background-color: #ffebe8; 287 | color: #333; 288 | border: 1px solid #cc0000; 289 | font-size: 12px; 290 | } 291 | 292 | .persona__warning-heading { 293 | display: inline-block; 294 | } 295 | 296 | /** 297 | * Registration screen. 298 | * 299 | * Hide the user email address in persona only auth. 300 | */ 301 | .persona--persona-only-auth.login-action-register .user_email, 302 | .persona--persona-only-auth.login-action-register [for=user_email], 303 | .persona--persona-only-auth.login-action-register #reg_passmail { 304 | display:none; 305 | } 306 | 307 | /** 308 | * Login/Registration screens. 309 | * 310 | * Push the submit button off the screen, but allow it to be 311 | * programatically clickable. 312 | */ 313 | .persona--persona-only-auth #wp-submit { 314 | position: absolute; 315 | left: -9999px !important; 316 | } 317 | 318 | /** 319 | * Comment form. 320 | * 321 | */ 322 | .persona--comments #respond input[type=submit] { 323 | position: absolute; 324 | left: -9999px !important; 325 | } 326 | 327 | /** 328 | * Login screen 329 | * 330 | * Hide the login form. While this does not truely prevent 331 | * users from from logging in using the standard 332 | * authentication mechanism, it cleans up the login form a bit. 333 | */ 334 | .persona--persona-only-auth.login-action-login #user_login, 335 | .persona--persona-only-auth.login-action-login [for=user_login], 336 | .persona--persona-only-auth.login-action-login #user_pass, 337 | .persona--persona-only-auth.login-action-login [for=user_pass], 338 | .persona--persona-only-auth.login-action-login [name=log], 339 | .persona--persona-only-auth.login-action-login [name=pwd] { 340 | display: none; 341 | } 342 | 343 | /** 344 | * Waiting screen 345 | */ 346 | .persona__submit { 347 | position: absolute; 348 | position: fixed; 349 | top: 0; 350 | left: 0; 351 | right: 0; 352 | bottom: 0; 353 | background-color: #fff; 354 | background-color: rgba(255,255,255,.7); 355 | z-index: 1000; 356 | } 357 | 358 | /** 359 | * These animations are used for the loading spinner. No animated gifs here. 360 | */ 361 | 362 | @-webkit-keyframes spin { 363 | from { 364 | -webkit-transform: rotate(0deg); 365 | } 366 | to { 367 | -webkit-transform: rotate(365deg); 368 | } 369 | } 370 | @-moz-keyframes spin { 371 | from { 372 | -moz-transform: rotate(0deg); 373 | } 374 | to { 375 | -moz-transform: rotate(365deg); 376 | } 377 | } 378 | @keyframes spin { 379 | from { 380 | transform: rotate(0deg); 381 | } 382 | to { 383 | transform: rotate(365deg); 384 | } 385 | } 386 | 387 | 388 | .persona__submit_spinner { 389 | background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAACC9JREFUeNrMWluMFEUUrdvz2DePXUEXlIeK+ADBiIqJoBJN1PhjVDAS/4zGV2KMH2o0fuivmphgQGPij8ag8qUmJpCYmOAmJqKofICIJiACLrqww+zOTHd5btetmZpmeqanZxbpyZ2q7umuvqfuo+69NbRg+5iKO7SQ7Qe2g6/ob6A5aG5B51r0l4EW4vwStINofbk3g7aMe46hPY7z/Wj3ov0W7a/KGbPZUXxo7VnXsqqzYwB0H2gjKXUrmJiV8LmlDeaMZ3QL6MM0jKQFMgx6Esw/Aw7mN7qB4mZXn31dm9tvFroG9FK7DHkpQDyO97IavKYEBEURJDxi1OhFXF+lHdWOUkdAMMAK8LgHtBWncxvxTe1jiQO2ZkYkghc8AeZ+Qne15ZJSs5tAOlqdUG2KJAmQt8DyO41m3AVDDWzDgVoGTSdRL5wfQLOz28b+Keh+l8GwjViy+xtc9DEiNaa1+g7XfsC1v9H+g58qopLspleAbgKtjXiwgxjoYbRn2gZCMRoCRrYxiOgMV/sU3hNKhVcVnO4CiK1ov8DlYov37pLZz6FZrw2YE6CvQROp3C81FvXLoMfkN19UkLSjLroG5it0n8P5vhTvL1tQnR6NVOsedq3CZFlAnKX26JxkJ4DudnUeHFEgfWDwTZnxKYDxAEZTTQieNoLYg/ZetH9qdX4cWa9erV4HLedwRuxBg+uATQB9j4xExtC/E+2kOo8OVyIcGjxNxrv4MvOhFkEk3M+xJ8L5OvFA5/RgXiqaSbdcR57HzXkyM83qFJAJeH20PaxGQLPp/wIxFWjVA26X92Waeq3VoM3AWpIHAwnkGEyPzMGz6B/KOG6upJOF3d0AkYNirx3MqoU5L0YiFN69Ed85dCesJIR49llKO9B+En2Y54YNR88wiDxesmEopy6ERZ/ydaxEGOJdquaafDZuMewByafeaLRusnR43GlZbLoPgmeX1O2zcuoCcBoHwgK5Ee2loFPa2IOnqTrJvXBXn6PdHTcAi9HDy85g5vwOIt84SawfyqoRAdFsbNaMVWhngwqiTr5nKFw/wOPHoXhiiG9iyQzgy1Odq1nVJsiAmA91Ot0ChHW/l4l3quj6IHYAX79LCpooH5gFMAUwUQrSA7GGfduQUafTgU4kZTxCF4FvRJsUiCRYvZj6Qb+ADpIga0UZAdMP8nV7UtBVF8uGnVXzAGIyIQgrkREy9hrYuJBqAd3+dpMjHoFnoIRgphgYtWsGgIU3FZZotLoca8QKUC8ll4Rr7Hlt3GxFBrcTzEB+S6MerGZzMx7aIATj16cHVTsq4YSBzMfasDSfUYt6zGJXaBOEzUfKZN4VOPkRCbhUthvIIMMwVFYPd3YtkDK+RvD7MjA/CtfHxl0MdPXZNLFWIMuAG3qwepVtTS5tDj6Nr7lgdgm7QEmMLfliT8MZYwtliaHSuu+skzz5EfX10wKxD42Ehl+zExdIWEeA3CeD7kQGWcmPA6taVM/PwjSSoNBGAMIzK3+lgYcLpH5KXQpxWCLHHQlUy7wSZy1uVxL88JDHIYGxAxvrxHmtbhWVeGU/SgZQRcgX4z+FdgloUZI1xHqr2aEkqGWsb/OLcvsLP8V5ykOOtH0HzASuLsCMrmwWopAMzXYwG9PBOUOQkCO+j2O0iq6v/reozXlxEtlHXIsyrtjHG3wyxICmQHc0k4SWFX3AM7FW0OaKHoYl8FhsSwmqhRkdKxFSP4LpA6Beq16qJhUurN1Apu7bEATrZL+XPmC0XE1r44IpXho2CvLiVIvv+0aZdLZiI2ABM8kZIvoPNAKSB/oeWR+CTgzVFrnYZrhs0+Aj0vDiklLPM0ztFO/V4xq9eLLj6G8ArXNBeDYro5rL7TR8V6oWTkTGAwCd1wkmg4PDL/HwkIzlGj6XhooY+VEIYB4nUWxMWY+a7XF0BChce7Sxt1DbtOq12HQT92tn+SM042SSvqobFsM/if4ol0a76PqTHn3alKJ0GKip1uWgP8DhZ8psq/lVD1aLxbDe0Gqcv6pM8flcHIOcFehahkA6JjD2Iova+wCwF8TlfxsVAwwJqSNSOnpBGzWcyWOO7AjbzWRquiBGFjdeaLdwXkTKumOyGaO1myO470q0r+B85QwAYHsYlR3iQNenFm3tIe4BvafMbJAYv3XHFceT8YueAj0CmtelAHYUnC4Gs33yHgugpV1mY+7YAUkwo5vx+2FlJGSCSaqWUifkWd51ulqZjf/vFe86JS+rklRwRlhVyTBdEJW26uRJ5VNJDY5igMSC/UAWw7t5+4zDorAyLyG/rbyQkQ6vuNdJIfyw0FFldqGmVK2GlxdHMSgA+lmVtCy+WnYBgMCTwrl18SQgdTsbPe6xjQwzm2TUCae4bdswGcR8FERqI1LQuEqyzLJsQZQESCCMlyWJnJTih1buzpiu7gLIghiKoqhiNlVb/vMBA+yAbP9iWyDjmk+IJOrASIzEJaWCk13aCCErTHLdu2TjOem7jNrZtxtKfJ6Rd5wR6aaSiD12kwn3HyTjqU5zvhKN62R/VHlyLsxpJ5UOmrjQ6PWM+CsGMKFapC7t/POBE7C30X0X7bgyW819yu5qRcAo1egPRDWGQ0PW4fs9XQs/+DynjQqGqoyL4ypB/pXmTzW8a/UzaA3efj3aBaJCPHNFC8ZtY2bfs7GnYx9lkfQ4781TGwlk2n8HFSX0H4M0eM/xCgZExhMNyu/W0KvrkOi7tZm8SGFa8p6TykTg42l2KTr9v1ZZpMPErvpiWRyHZYXuk2TIgtHyTEE8GQP4V6jYCSP/CTAAr5kcJEeom/4AAAAASUVORK5CYII='); 390 | display: block; 391 | top: 30%; 392 | left: 50%; 393 | margin: -25px 0 0 -50px; 394 | width: 50px; 395 | height: 50px; 396 | position: absolute; 397 | -webkit-animation: 0.9s spin infinite linear; 398 | -moz-animation: 0.9s spin infinite linear; 399 | animation: 0.9s spin infinite linear; 400 | } 401 | 402 | 403 | .persona__widget-button-container { 404 | list-style-type: none; 405 | } 406 | 407 | -------------------------------------------------------------------------------- /readme.txt: -------------------------------------------------------------------------------- 1 | === Mozilla Persona (BrowserID) === 2 | Contributors: stomlinson, Marcel Bokhorst, M66B 3 | Tags: security, admin, authentication, access, widget, login, shortcode, comment, comments, discussion, bbPress, bbPress 2.0, browserid, mozilla, persona, password 4 | Requires at least: 3.1 5 | Tested up to: 3.9.1 6 | Stable tag: 0.50 7 | License: GPLv2 or later 8 | License URI: http://www.gnu.org/licenses/gpl-2.0.htm 9 | 10 | Implementation of Mozilla Persona (BrowserID) for WordPress 11 | 12 | == Description == 13 | 14 | [Mozilla Persona](https://login.persona.org/ "Mozilla Persona") is an open source identity system from the [Identity Team](http://identity.mozilla.com/ "Identity Team") at [Mozilla](https://mozilla.org/ "Mozilla"). More information on Persona can be found at [https://login.persona.org/about](https://login.persona.org/about). 15 | 16 | This plugin allows users to sign up, sign in, and comment on your site using Persona. 17 | 18 | ** Reporting problems: ** 19 | 20 | Please report any issues on [GitHub](https://github.com/shane-tomlinson/browserid-wordpress/issues). 21 | 22 | ** Beta features: ** 23 | 24 | * [bbPress 2](http://bbpress.org/ "bbPress") integration: create topics / reply with Mozilla Persona 25 | 26 | 27 | == Installation == 28 | 29 | *Using the WordPress dashboard* 30 | 31 | 1. Login to your weblog 32 | 1. Go to Plugins 33 | 1. Select Add New 34 | 1. Search for Mozilla Persona 35 | 1. Select Install 36 | 1. Select Install Now 37 | 1. Select Activate Plugin 38 | 39 | *Manual* 40 | 41 | 1. Download and unzip the plugin 42 | 1. Upload the entire *browserid/* directory to the */wp-content/plugins/* directory 43 | 1. Activate the plugin through the Plugins menu in WordPress 44 | 45 | == Frequently Asked Questions == 46 | 47 | = Where can I find out more about Persona? = 48 | https://login.persona.org/about 49 | 50 | = What is 'Custom login HTML for?' = 51 | Try putting the following into this option: 52 | 53 | `` 54 | 55 | Now you will see a red 'Sign in with Persona' button instead of the traditional CSS button. 56 | 57 | = Which server verifies the assertion? = 58 | 59 | The assertion is verified by the server at https://verifier.login.persona.org/verify. 60 | 61 | = I get 'Login failed' = 62 | 63 | Only users that registered before can login. The e-mail address used for Mozilla Persona should match the e-mail address registered with. 64 | 65 | = I get 'Verification failed' = 66 | 67 | Are you cheating? 68 | If there isn't an error message, turn on debug mode to see the complete response. 69 | 70 | = I get 'Verification void' = 71 | 72 | Something went terribly wrong. 73 | If there isn't an error message, turn on debug mode to see the complete response. 74 | 75 | = Where can I ask questions, report bugs and request features? = 76 | 77 | You can write comments on [GitHub](https://github.com/shane-tomlinson/browserid-wordpress/issues). 78 | 79 | == Screenshots == 80 | 81 | 1. WordPress login with Persona 82 | 2. Wordpress login with "Disable Non-Persona authentication" 83 | 3. Login widget 84 | 4. Comment with Persona 85 | 5. Persona dialog using siteName, siteLogo and backgroundColor 86 | 87 | == Getting Involved == 88 | 89 | == Maintainers == 90 | * [Shane Tomlinson](https://shanetomlinson.com) - shane@shanetomlinson.com or stomlinson@mozilla.com 91 | * [Marcel Bokhorst](http://blog.bokhorst.biz) 92 | 93 | 94 | == Changelog == 95 | 96 | = Development version = 97 | * ... 98 | 99 | Follow these steps to install the development version: 100 | 101 | * Download the development version by clicking on [this link](http://downloads.wordpress.org/plugin/browserid.zip) 102 | * Go to *Plugins* on your WordPress dashboard 103 | * *Deactivate* Mozilla Persona 104 | * *Delete* Mozilla Persona (*Yes, delete these files*) 105 | * Click *Add New* 106 | * Click *Upload* (a link at the top) 107 | * Click *Choose file* and select the file you downloaded before 108 | * Click *Install*, then *Activate Plugin* 109 | 110 | = 0.50 = 111 | * New Feature: Ukranian translations - thanks Michael Yunat (http://getvoip.com) 112 | 113 | = 0.49 = 114 | * Bug Fix: Fix strict errors displayed on admin page. thanks @jasondmoss! 115 | 116 | = 0.48 = 117 | * Bug Fix: Allow signed in users to comment without using Persona. Allow comments from admin panel. 118 | 119 | = 0.47 = 120 | * Bug Fix: Disable error reporting - thanks @jonchang! 121 | 122 | = 0.46 = 123 | * New Feature: Use the WordPress color picker when selecting a background color - Thanks @janw-oostendorp! 124 | * New Feature: Use the WordPress media picker when selecting the site logo, terms of service and privacy policy. 125 | * New Feature: Automatically convert site logo's into dataURIs so that any site can specify a logo. 126 | * New Feature: Japanese Translations - Thanks @makotokato! 127 | * Improvement: Separate general and advanced settings. 128 | * Improvement: Serve minified Javascript and CSS by default. 129 | * Improvement: massive refactor to make code easier to browse. 130 | * Bug Fix: Fix typo in Privacy Policy description - Thanks @KryDos! 131 | * Bug Fix: Make sure URLs are written to browserid_common.js unescaped. 132 | 133 | = 0.45 = 134 | * New Feature: Russian Translations - Thanks Ruslan Bekenev (@KryDos)! 135 | * New Feature: French (CA and FR) - Thanks Fabian Rodriguez (@MagicFab)! 136 | * New Feature: backgroundColor support! 137 | * New Feature: termsOfService and privacyPolicy support! 138 | * New Feature: Select one of 3 Persona button styles 139 | * Improvement: Localize widget buttons 140 | * Improvement: Updated Dutch translation - Thanks @janw-oostendorp! 141 | * Bug Fix: Prevent comments being accepted without assertion 142 | * Bug Fix: Admins can add new users 143 | * Bug Fix: Use Persona button for comments 144 | * Bug Fix: Fix live events not working with jQuery 1.9+ - Thanks @davidmurdoch! 145 | * Bug Fix: Get rid of the warning on the Persona settings page - Thanks @KryDos 146 | 147 | = 0.44 = 148 | * Improvement: Commenting for new Persona users is simpler 149 | * Improvement: New member registration with new Persona users is simpler 150 | * Improvement: Separate CSS into its own file for maintainability 151 | * Improvement: Replace .png signin buttons with localizable CSS buttons 152 | * Improvement: Pre-fill input fields with default values in configuration screen 153 | * Improvement: Do not show the lost password link if "Disable non-Persona auth" is selected 154 | * Improvement: Do not show the "default password nag" if "Disable non-Persona auth" is selected 155 | * Improvement: Code Cleanup. 156 | * New feature: A .PO file with all strings has been created for localization 157 | * New Feature: Spanish translations. Thanks Guillermo Movia! 158 | * Bug Fix: site name can now contain ' and & 159 | * Bug Fix: no more static warnings in strict PHP mode 160 | * Bug Fix: remove plugin options from database when de-activated 161 | * Bug Fix: incorrect button link for example button link in the FAQ 162 | 163 | = 0.43 = 164 | * Continue with 0.41 165 | * Bug Fix: Fix the missing arguments errors 166 | * Bug Fix: HTML Escape the hostname when printing debug information 167 | * Bug Fix: Logout link from the widget signs the user out of Persona 168 | * Security Improvement: Remove the "Noverify SSL Certificate" option 169 | 170 | = 0.42 = 171 | * Revert to 0.37 172 | 173 | = 0.41 = 174 | * Bug Fix: Fix the "missing arguments" error due to not declaring the number of expected variables to Set_auth_cookie_action. 175 | 176 | = 0.40 = 177 | * New Feature: Add option to disable normal username/password auth. 178 | * Improvement: Convert from navigator.id.get to navigator.id.watch/.request API. 179 | * * New Feature: If user signs out of Persona, they are signed out of the Wordpress site as well. 180 | * New Feature: Easier user signup when using Persona - no email verification required. 181 | * Improvement: Better comment integration, especially for new users. 182 | * Improvement: Update the login/logout widget to match styling of other Wordpress widgets. 183 | * Improvement: Add a "Settings" link to the BrowserID list item in the plugins list. 184 | * Bug Fix: Fix a bug where server clock skew from the Persona servers could prevent users from signing in. 185 | * Improvement: Update "Sign in" buttons to use the new Persona button style. 186 | * Improvement: Unify signin and comment Javascript. 187 | 188 | = 0.37 = 189 | * Bump version number for new maintainer info. 190 | 191 | = 0.36 = 192 | * Bugfix: *browserid_error* 193 | 194 | = 0.35 = 195 | * Bugfix: redirect option, thanks *Lwangaman*! 196 | 197 | = 0.34 = 198 | * Added Italian translation by [John R. D'Orazio](http://johnromanodorazio.blogspot.it/ "John R. D'Orazio") 199 | 200 | = 0.33 = 201 | * Updated URL to verification server 202 | * Updated Mozilla CA certificates 203 | 204 | = 0.32 = 205 | * Fixed notices 206 | * Updated French translation 207 | 208 | = 0.31 = 209 | * Renamed Mozilla BrowserID into Mozilla Persona 210 | * New feature: site name/logo in login dialog 211 | * Both by [Shane Tomlinson](https://shanetomlinson.com/), thanks! 212 | * Added French translation 213 | * Updated Dutch and Flemish translations 214 | * Tested with WordPress 3.4.1 215 | 216 | = 0.29 = 217 | * Added Swedish (sv\_SE) translation 218 | * Improvement: load scripts at footer by *Marvin Rühe* 219 | * Tested with WordPress 3.4 220 | 221 | = 0.28 = 222 | * Improvement: POST assertion by *Marvin Rühe* 223 | * Improvement: included Mozilla CA certificates 224 | * Improvement: included BrowserID logo 225 | * New feature: login button localization 226 | * Added German Translation by *Marvin Rühe* 227 | 228 | = 0.27 = 229 | * Bugfix: remember me 230 | 231 | = 0.26 = 232 | * New feature: BrowserID for comments (beta, option) 233 | * New feature: bbPress integration (beta, option) 234 | * Improvement: added title/class to BrowserID buttons 235 | * Improvement: files instead of inline JavaScript script 236 | * Improvement: added 'What is?' link 237 | * Improvement: more debug info 238 | * Updated Dutch and Flemish translations 239 | * Updated Norwegian (nb\_NO) translation by [Stein Ivar Johnsen](http://www.idyrøy.no/ "Stein Ivar Johnsen") 240 | 241 | = 0.25 = 242 | * Improvement: store debug info only when debugging enabled 243 | * Improvement: add trailing slash to site URL 244 | * Improvement: respect login redirect to parameter 245 | * Improvement: better error messages 246 | * Thanks to [mitcho](http://mitcho.com "mitcho") for the suggestions and testing! 247 | 248 | = 0.24 = 249 | * Removed [Sustainable Plugins Sponsorship Network](http://pluginsponsors.com/) 250 | 251 | = 0.23 = 252 | * Improvement: compatibility with WordPress 3.3 253 | 254 | = 0.22 = 255 | * Re-release of version 0.21, because of a bug in wordpress.org 256 | 257 | = 0.21 = 258 | * Bugfix: renamed *valid-until* into *expires* 259 | * Improvement: fixed a few notices 260 | 261 | = 0.20 = 262 | * Bugfix: shortcode still not working 263 | 264 | = 0.19 = 265 | * Bugfix: widget, shortcode, template tag not working 266 | 267 | = 0.18 = 268 | * Improvement: workaround for bug in Microsoft IIS 269 | 270 | = 0.17 = 271 | * Improvement: applying filter *login_redirect* 272 | 273 | = 0.16 = 274 | * Improvement: only load BrowserID script on login page 275 | 276 | = 0.15 = 277 | * **Protocol change**: verification with POST instead of GET 278 | * Improvement: no logout link on login page 279 | * Updated Dutch and Flemish translations 280 | * Updated Norwegian (nb\_NO) translation by [Stein Ivar Johnsen](http://www.idyrøy.no/ "Stein Ivar Johnsen") 281 | 282 | = 0.14 = 283 | * New feature: option to redirect to set URL after login 284 | 285 | = 0.13 = 286 | * Bug fix: correctly handling WordPress errors 287 | 288 | = 0.12 = 289 | * Improvement: check issuer 290 | * Improvement: more debug info 291 | 292 | = 0.11 = 293 | * Fixed IDN 294 | 295 | = 0.9 = 296 | * New feature: shortcode for login/out button/link: *[mozilla_persona]* 297 | * New feature: template tag for login/out button/link: *mozilla_persona* 298 | * Updated Dutch and Flemish translations 299 | * Updated Norwegian (nb\_NO) translation by [Stein Ivar Johnsen](http://www.idyrøy.no/ "Stein Ivar Johnsen") 300 | 301 | = 0.8 = 302 | * New feature: option to set verification server 303 | * Improvement: checking assertion valid until time (can be switch off with an option) 304 | * Improvement: using [idn_to_utf8](http://php.net/manual/en/function.idn-to-utf8.php "idn_to_utf8") when available 305 | * Updated FAQ 306 | * Updated Dutch and Flemish translations 307 | 308 | = 0.7 = 309 | * New feature: support for *Remember Me* check box 310 | * Updated Norwegian (nb\_NO) translation by [Stein Ivar Johnsen](http://www.idyrøy.no/ "Stein Ivar Johnsen") 311 | 312 | = 0.6 = 313 | * New feature: option *Do not verify SSL certificate* 314 | * Updated Dutch and Flemish translations 315 | 316 | = 0.5 = 317 | * Improvement: more debug info 318 | * Tested with WordPress 3.1 319 | 320 | = 0.4 = 321 | * Bug fix: using site URL in stead of home URL 322 | * Updated FAQ 323 | 324 | = 0.3 = 325 | * Improvement: better error messages 326 | * Improvement: more debug info 327 | * Improvement: support for [internationalized domain names](http://en.wikipedia.org/wiki/Internationalized_domain_name "IDN") 328 | * Updated FAQ 329 | * Added Norwegian (nb\_NO) translation by [Stein Ivar Johnsen](http://www.idyrøy.no/ "Stein Ivar Johnsen"), thanks! 330 | 331 | = 0.2 = 332 | * Bugfix: custom HTML for login page 333 | * Added Flemish translation 334 | * Updated Dutch translation 335 | 336 | = 0.1 = 337 | * Initial version 338 | 339 | = 0.0 = 340 | * Development version 341 | 342 | == Upgrade Notice == 343 | 344 | = 0.50 = 345 | Ukranian translations 346 | 347 | = 0.49 = 348 | 1 bug fix 349 | 350 | = 0.48 = 351 | 1 bug fix 352 | 353 | = 0.47 = 354 | 1 bug fix 355 | 356 | = 0.46 = 357 | 4 new features, 3 improvements, 2 bug fixes 358 | 359 | = 0.45 = 360 | Russian, French, Dutch translations. backgroundColor, termsOfService and privacyPolicy support. Multiple Persona button styles. Multiple bug fixes. 361 | 362 | = 0.44 = 363 | Spanish translations, 8 improvements, 4 bug fixes 364 | 365 | = 0.43 = 366 | Security improvement, three bug fixes 367 | 368 | = 0.42 = 369 | Revert to v0.37 until update process is figured out 370 | 371 | = 0.41 = 372 | Bug fix for "missing arguments" error 373 | 374 | = 0.40 = 375 | Three new features, six improvements, one bug fix 376 | 377 | = 0.37 = 378 | Maintainer change - info update 379 | 380 | = 0.36 = 381 | One bugfix 382 | 383 | = 0.33 = 384 | Updated URL to verification server 385 | 386 | = 0.32 = 387 | Fixed notices 388 | 389 | = 0.31 = 390 | Renamed Mozilla BrowserID into Mozilla Persona 391 | 392 | = 0.29 = 393 | One improvement, one new translation 394 | 395 | = 0.28 = 396 | One new feature, three improvements 397 | 398 | = 0.27 = 399 | One bugfix 400 | 401 | = 0.26 = 402 | Two new features, four improvements, translation updates 403 | 404 | = 0.25 = 405 | Four improvements 406 | 407 | = 0.24 = 408 | Compliance 409 | 410 | = 0.23 = 411 | Compatibility 412 | 413 | = 0.21 = 414 | One bugfix, one improvement 415 | 416 | = 0.20 = 417 | One bugfix 418 | 419 | = 0.19 = 420 | One bugfix 421 | 422 | = 0.18 = 423 | One improvement 424 | 425 | = 0.17 = 426 | One improvement 427 | 428 | = 0.16 = 429 | One improvement 430 | 431 | = 0.15 = 432 | Protocol change! Verification with POST instead of GET 433 | 434 | = 0.14 = 435 | One new feature 436 | 437 | = 0.13 = 438 | One bugfix 439 | 440 | = 0.12 = 441 | Two improvements 442 | 443 | = 0.11 = 444 | Fixed IDN 445 | 446 | = 0.9 = 447 | Two new features, translation update 448 | 449 | = 0.8 = 450 | One new feature, two improvements 451 | 452 | = 0.7 = 453 | One new feature 454 | 455 | = 0.6 = 456 | One new feature 457 | 458 | = 0.5 = 459 | One improvement 460 | 461 | = 0.4 = 462 | Bugfix 463 | 464 | = 0.3 = 465 | Three improvements 466 | 467 | = 0.2 = 468 | One bugfix 469 | 470 | = 0.1 = 471 | First public release 472 | 473 | == Acknowledgments == 474 | * [Marcel Bokhorst](http://blog.bokhorst.biz/) is the original author of this plugin. His awesome work has allowed me to continue. 475 | * [Guillermo Movia](mailto://deimidis@mozilla-hispano.org) for Spanish translations. 476 | * [Ruslan Bekenev - @KryDos](https://github.com/KryDos) for Russian translations, bug fixes, and continued support. 477 | * [Fabian Rodriguez - @MagicFab](https://github.com/MagicFab) for French and Canadian French translations as well as man bug reports. 478 | * [Edwin Wong @edmoz](http://www.edwinsf.com/blog/) for continued testing. 479 | * [@janw-oostendorp](https://github.com/janw-oostendorp) for updated Dutch translations. 480 | * [David Murdoch @davidmurdoch](https://github.com/davidmurdoch/) fixing jQuery 1.9+ compatability 481 | * [Makoto Kato @makotokato](https://github.com/makotokato) for Japanese translations. 482 | * [Johnathan Chang @jonchang](https://github.com/jonchang) for patch to disable error reporting. 483 | 484 | 485 | This plugin uses: 486 | 487 | * The client side [Mozilla Persona script](https://login.persona.org/include.js "Mozilla Persona script") 488 | -------------------------------------------------------------------------------- /browserid.js: -------------------------------------------------------------------------------- 1 | /*jshint browser: true*/ 2 | /*global browserid_common, jQuery*/ 3 | (function() { 4 | "use strict"; 5 | 6 | var $ = jQuery; 7 | 8 | // what login type is being handled? 9 | var loginType; 10 | 11 | // When onlogin is invoked and there is no login state, should submit be forced? 12 | var forceSubmit; 13 | 14 | // Keep track of whether the onlogout callback should be ignored. Ignoring 15 | // the onlogout callback prevents the user from being redirected to the 16 | // logout page. 17 | var ignoreLogout = false; 18 | 19 | // Disable the registration form submit until after an assertion has been 20 | // returned. This allows users to press "enter" in the username field and 21 | // have the Persona disalog displayed 22 | var enableRegistrationSubmit = false; 23 | 24 | // If the user is trying to submit the form before they have received 25 | // a Persona assertion, prevent the form from being submitted. This takes 26 | // effect if the user types "enter" into one of the commentor info fields. 27 | var enableCommentSubmit = browserid_common.loggedInUser || false; 28 | 29 | var state; 30 | 31 | $(".js-persona__login").click(function(event) { 32 | event.preventDefault(); 33 | 34 | ignoreLogout = false; 35 | requestAuthentication("login"); 36 | }); 37 | 38 | // the js-persona__logout button in the admin toolbar is added after this 39 | // script is run. Attach a live event (yuck) so that the user is still 40 | // able to log out. 41 | liveEvent(".js-persona__logout", "click", function(event) { 42 | ignoreLogout = false; 43 | navigator.id.logout(); 44 | }); 45 | 46 | if (browserid_common.isPersonaUsedWithComments) { 47 | $("body").addClass("persona--comments"); 48 | 49 | $(".js-persona__submit-comment").click(function(event) { 50 | event.preventDefault(); 51 | $("#commentform").submit(); 52 | }); 53 | 54 | $("#commentform").submit(function(event) { 55 | // Make sure there is a comment before submitting 56 | if ($("#comment").hasClass("disabled")) { 57 | event.preventDefault(); 58 | return; 59 | } 60 | 61 | // If the user is trying to submit the form before they have received 62 | // a Persona assertion, prevent the form from being submitted and instead 63 | // open the Persona dialog. This takes effect if the user types "enter" 64 | // into one of the commentor info fields. 65 | if (!enableCommentSubmit) { 66 | event.preventDefault(); 67 | 68 | verifyUserForComment(); 69 | } 70 | }); 71 | } 72 | 73 | if (browserid_common.isPersonaOnlyAuth) { 74 | $("body").addClass("persona--persona-only-auth"); 75 | 76 | // Make sure there is a username before submitting 77 | enableSubmitWhenValid("#user_login", ".js-persona__register"); 78 | 79 | $(".js-persona__register").click(function(event) { 80 | event.preventDefault(); 81 | 82 | if ($(event.target).hasClass("disabled")) return; 83 | 84 | ignoreLogout = false; 85 | // Save the form state to localStorage. This allows a new user to close 86 | // this tab while they are verifying and still have the registration 87 | // complete once the address is verified. 88 | saveRegistrationState(); 89 | requestAuthentication("register"); 90 | }); 91 | 92 | $("#registerform").submit(function(event) { 93 | // form submission is disabled so the user can press enter in the username 94 | // field and see the Persona dialog. After an assertion has been generated, 95 | // submission is re-enabled and data should be sent to the server. 96 | if (enableRegistrationSubmit) return; 97 | 98 | event.preventDefault(); 99 | 100 | // If the username has no length, abort 101 | if ($("#user_login").val().length === 0) return; 102 | 103 | ignoreLogout = false; 104 | // Save the form state to localStorage. This allows a new user to close 105 | // this tab while they are verifying and still have the registration 106 | // complete once the address is verified. 107 | saveRegistrationState(); 108 | requestAuthentication("register"); 109 | }); 110 | } 111 | 112 | if (document.location.hash === "#submit_comment") { 113 | // During comment submission, ignore the logout messages until 114 | // the user explicitly requests a login. 115 | ignoreLogout = true; 116 | 117 | showWaitingScreen(); 118 | 119 | // load the state into the form to reduce flicker. The form data may not be 120 | // needed, but load it anyways. 121 | state = loadCommentState(); 122 | 123 | // If there is no state, the other window has already submitted the comment. 124 | // navigator.id.logout has already been called and no assertion will be 125 | // generated. wait for the signal from the other window and refresh the page 126 | // to view the newly inserted comment. 127 | if (!state) return refreshWhenCommentSubmitComplete(); 128 | 129 | loginType = "comment"; 130 | 131 | // If this is the post Persona verification page AND we got the state 132 | // before the other page, forceSubmit. loadCommentState removes the 133 | // comment state from localStorage which normally causes onlogin to 134 | // abort all action. 135 | forceSubmit = true; 136 | } 137 | else if (document.location.hash === "#submit_registration") { 138 | ignoreLogout = true; 139 | 140 | showWaitingScreen(); 141 | 142 | // load the state into the form to reduce flicker. The form data may not be 143 | // needed, but load it anyways. 144 | state = loadRegistrationState(); 145 | 146 | // If there is no state, the other window has already submitted the registration. 147 | // Wait for the signal from the other window which causes a refresh. When 148 | // the signal comes, refresh to the profile page. 149 | if (!state) return refreshWhenRegistrationSubmitComplete(); 150 | 151 | loginType = "register"; 152 | 153 | // If this is the post Persona verification page AND we got the state 154 | // before the other page, forceSubmit. loadRegistrationState removes the 155 | // comment state from localStorage which normally causes onlogin to 156 | // abort all action. 157 | forceSubmit = true; 158 | } 159 | else if ((document.location.href === browserid_common.urlRegistrationRedirect) && 160 | (sessionStorage.getItem("submitting_registration"))) { 161 | // If the user lands on the urlRegistrationRedirect page AND they just came 162 | // from the Registration page, inform other pages that registration has 163 | // completed so they can redirect. 164 | localStorage.setItem("registration_complete", "true"); 165 | } 166 | else if (sessionStorage.getItem("submitting_comment")) { 167 | ignoreLogout = true; 168 | 169 | // If the user just completed comment submission, save the hash to 170 | // localStorage so the other window can refresh to the new comment. 171 | // We are just assuming the comment submission was successful. 172 | sessionStorage.removeItem("submitting_comment"); 173 | localStorage.setItem("comment_hash", document.location.hash); 174 | } 175 | 176 | 177 | 178 | // If there was on error, log the user out. 179 | if (browserid_common.msgError || $("#login_error").length) { 180 | ignoreLogout = true; 181 | 182 | navigator.id.logout(); 183 | } 184 | 185 | 186 | 187 | var loginHandlers = { 188 | login: submitLoginForm, 189 | register: submitRegistrationForm, 190 | comment: submitCommentForm 191 | }; 192 | 193 | navigator.id.watch({ 194 | loggedInUser: browserid_common.loggedInUser || null, 195 | onlogin: function(assertion) { 196 | loginType = getLoginType(loginType); 197 | 198 | var handler = loginHandlers[loginType]; 199 | if (handler) { 200 | handler(assertion); 201 | } 202 | }, 203 | onlogout: function() { 204 | // The logout was either due to an error which must be shown or to 205 | // the user leaving a comment but not being logged in. Either way, 206 | // do not redirect the user, they are where they want to be. 207 | if (ignoreLogout) return; 208 | } 209 | }); 210 | 211 | function getLoginType(loginType) { 212 | return loginType || "login"; 213 | } 214 | 215 | 216 | function requestAuthentication(type) { 217 | loginType = type; 218 | 219 | var opts = { 220 | siteName: browserid_common.siteName || "", 221 | siteLogo: browserid_common.siteLogo || "", 222 | backgroundColor: browserid_common.backgroundColor || "", 223 | termsOfService: browserid_common.termsOfService || "", 224 | privacyPolicy: browserid_common.privacyPolicy || "" 225 | }; 226 | 227 | /** 228 | * If the user is signing in to comment or signing up as a new member 229 | * and must verify, redirect with a special hash. The form will be 230 | * submitted by the first page to receive an onlogin. 231 | * 232 | * This behavior is necessary because we are unsure whether the user 233 | * will complete verification in the original window or in a new window. 234 | */ 235 | if (loginType === "comment") { 236 | opts.returnTo = getReturnToUrl("#submit_comment"); 237 | } 238 | else if (loginType === "register") { 239 | opts.returnTo = getReturnToUrl("#submit_registration"); 240 | } 241 | 242 | navigator.id.request(opts); 243 | } 244 | 245 | 246 | 247 | 248 | 249 | 250 | /** 251 | * LOGIN CODE 252 | */ 253 | function submitLoginForm(assertion) { 254 | var rememberme = document.getElementById("rememberme"); 255 | if (rememberme !== null) 256 | rememberme = rememberme.checked; 257 | 258 | // Since login can happen on any page, create a form 259 | // and submit it manually ignoring the normal sign in form. 260 | var form = document.createElement("form"); 261 | form.setAttribute("style", "display: none;"); 262 | form.method = "POST"; 263 | form.action = browserid_common.urlLoginSubmit; 264 | 265 | var fields = { 266 | browserid_assertion: assertion, 267 | rememberme: rememberme 268 | }; 269 | 270 | // XXX is this necessary? Won't it be fetched from options? 271 | if (browserid_common.urlLoginRedirect !== null) 272 | fields.redirect_to = browserid_common.urlLoginRedirect; 273 | 274 | appendFormHiddenFields(form, fields); 275 | 276 | $("body").append(form); 277 | form.submit(); 278 | } 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | /** 287 | * COMMENT CODE 288 | */ 289 | 290 | function verifyUserForComment() { 291 | ignoreLogout = true; 292 | // Save the form state to localStorage. This allows a new user to close 293 | // this tab while they are verifying and still have the comment form 294 | // submitted once the address is verified. 295 | saveCommentState(); 296 | requestAuthentication("comment"); 297 | } 298 | 299 | function submitCommentForm(assertion) { 300 | // If this is a new user that is verifying their email address in a new 301 | // window, both the original window and this window will be trying to 302 | // submit the comment form. The first one wins. The other one reloads. 303 | var state = loadCommentState(); 304 | if (!(state || forceSubmit)) return refreshWhenCommentSubmitComplete(); 305 | 306 | var form = $("#commentform"); 307 | 308 | // Get the post_id from the dom because the postID could in theory 309 | // change from the original if the submission is happening in a 310 | // new tab after email verification. 311 | var post_id = $("#comment_post_ID").val(); 312 | 313 | appendFormHiddenFields(form, { 314 | browserid_comment: post_id, 315 | browserid_assertion: assertion 316 | }); 317 | 318 | // Save the hash so the other window can redirect to the proper comment 319 | // when everything has completed. 320 | localStorage.removeItem("comment_hash"); 321 | sessionStorage.setItem("submitting_comment", "true"); 322 | 323 | // If the user is submitting a comment and is not logged in, 324 | // log them out of Persona. This will prevent the plugin from 325 | // trying to log the user in to the site once the comment is posted. 326 | if (!browserid_common.loggedInUser) { 327 | ignoreLogout = true; 328 | navigator.id.logout(); 329 | } 330 | 331 | // Allow the form submission to send data to the server. 332 | enableCommentSubmit = true; 333 | 334 | $("#submit").click(); 335 | } 336 | 337 | function saveCommentState() { 338 | var state = { 339 | author: $("#author").val(), 340 | url: $("#url").val(), 341 | comment: $("#comment").val(), 342 | comment_parent: $("#comment_parent").val() 343 | }; 344 | 345 | localStorage.setItem("comment_state", JSON.stringify(state)); 346 | } 347 | 348 | function loadCommentState() { 349 | var state = localStorage.getItem("comment_state"); 350 | 351 | if (state) { 352 | state = JSON.parse(state); 353 | $("#author").val(state.author); 354 | $("#url").val(state.url); 355 | $("#comment").val(state.comment); 356 | $("#comment_parent").val(state.comment_parent); 357 | localStorage.removeItem("comment_state"); 358 | } 359 | 360 | return state; 361 | } 362 | 363 | function refreshWhenCommentSubmitComplete() { 364 | // wait until the other window has completed the comment submit. When it 365 | // completes, it will store the hash of the comment that this window should 366 | // show. 367 | var hash = localStorage.getItem("comment_hash"); 368 | if (hash) { 369 | localStorage.removeItem("comment_hash"); 370 | document.location.hash = hash; 371 | document.location.reload(true); 372 | } 373 | else { 374 | setTimeout(refreshWhenCommentSubmitComplete, 100); 375 | } 376 | } 377 | 378 | 379 | 380 | 381 | 382 | 383 | /** 384 | * REGISTRATION CODE 385 | */ 386 | 387 | function submitRegistrationForm(assertion) { 388 | // If this is a new user that is verifying their email address in a new 389 | // window, both the original window and this window will be trying to 390 | // submit the comment form. The first one wins. The other one reloads. 391 | var state = loadRegistrationState(); 392 | if (!(state || forceSubmit)) return refreshWhenRegistrationSubmitComplete(); 393 | 394 | // Save an item on sessionStorage that says we are completing registration. 395 | // When the page lands on the registration_complete redirect, it will check 396 | // sessionStorage, and if submitting_registration is set, it will notify 397 | // any other windows that registration has completed by setting a bit in 398 | // localStorage. 399 | sessionStorage.setItem("submitting_registration", "true"); 400 | $("#browserid_assertion").val(assertion); 401 | 402 | // Allow the form submission to send data to the server. 403 | enableRegistrationSubmit = true; 404 | $("#wp-submit").click(); 405 | } 406 | 407 | function saveRegistrationState() { 408 | var state = { 409 | user_login: $("#user_login").val() 410 | }; 411 | 412 | localStorage.setItem("registration_state", JSON.stringify(state)); 413 | } 414 | 415 | function loadRegistrationState() { 416 | var state = localStorage.getItem("registration_state"); 417 | 418 | if (state) { 419 | state = JSON.parse(state); 420 | $("#user_login").val(state.user_login); 421 | localStorage.removeItem("registration_state"); 422 | } 423 | 424 | return state; 425 | } 426 | 427 | function refreshWhenRegistrationSubmitComplete() { 428 | // wait until the other window has completed the registration submit. When it 429 | // completes, it will store a bit in localStorage when registration has 430 | // completed. 431 | var complete = localStorage.getItem("registration_complete"); 432 | if (complete) { 433 | localStorage.removeItem("registration_complete"); 434 | document.location = browserid_common.urlRegistrationRedirect; 435 | } 436 | else { 437 | setTimeout(refreshWhenRegistrationSubmitComplete, 100); 438 | } 439 | } 440 | 441 | 442 | 443 | 444 | 445 | /** 446 | * HELPER CODE 447 | */ 448 | function getReturnToUrl(hash) { 449 | return document.location.href 450 | .replace(/http(s)?:\/\//, "") 451 | .replace(document.location.host, "") 452 | .replace(/#.*$/, '') + hash; 453 | } 454 | 455 | function appendFormHiddenFields(form, fields) { 456 | form = $(form); 457 | 458 | for (var name in fields) { 459 | var field = document.createElement("input"); 460 | field.type = "hidden"; 461 | field.name = name; 462 | field.value = fields[name]; 463 | form.append(field); 464 | } 465 | } 466 | 467 | function showWaitingScreen() { 468 | var waitingScreen = $("
"); 469 | $("body").append(waitingScreen); 470 | } 471 | 472 | function enableSubmitWhenValid(textField, submitButton) { 473 | $(submitButton).addClass("disabled"); 474 | $(textField).keyup(validate); 475 | $(textField).change(validate); 476 | 477 | function validate() { 478 | var val = $(textField).val(); 479 | // only submit val form if there is a val. 480 | if (val && val.trim().length) { 481 | $(submitButton).removeClass("disabled"); 482 | } 483 | else { 484 | $(submitButton).addClass("disabled"); 485 | } 486 | } 487 | } 488 | 489 | function liveEvent(selector, eventType, callback) { 490 | $("body")[typeof $.fn.on === "function" ? "on" : "delegate"](eventType, selector, callback); 491 | } 492 | 493 | 494 | 495 | }()); 496 | --------------------------------------------------------------------------------