This is a simple Javascript OpenID selector. It has been designed so that users do not even need to know what OpenID is to use it, they simply select their account by a recognisable logo.
What was done:
http://code.google.com/p/openid-selector/
See http://openid-selector.googlecode.com/svn/trunk/demo.html
Paste next code in your view:
$this->widget('application.widgets.openidProviders.openidProviders',array('options'=>array('lang'=>'ru','demo'=>'js:true')));
Its very simple to understand:
1. List of providers and locale properties defiled in 'assets/js/assets-jquery-{locale}.js'
2. CSS file is in 'assets/css/openid.css' directory
3. Views are in 'views/main-{locale}.php'
4. Native openid props can be changed from widget call adding 'options' array:
- version: '1.2', // version constant
- demo: false, //if false - there is only alert message not redirecting to provider
- demo_text: 'In client demo mode. Normally would have submitted OpenID:',
- cookie_expires: 6*30, // 6 months.
- cookie_name: 'openid_provider',
- cookie_path: '/',
- img_path: 'images/', //path to images dir by default is staged by widget in assets dir
- lang: null, // language, is set in openid-jquery-.js //staged by widget in 'en'
- signin_text: null, // text on submit button on the form
- input_id: null,
- provider_url: null,
- provider_id: null,
- all_small: false, // output large providers w/ small icons
- no_sprite: false, // don't use sprite image
- image_title: '{provider}', // for image title
Now there are English, Russian and Ukrainian languages available
1. Create view in '/views' dir with your locale naming short-code
2. Create providers list in '/assets/js' dir with your locale naming short-code
3. If it`s differs from existing image sprites - generate sprites by instruments from '/tools' dir. See readme to get hints.
Please remember after you change list of providers, you must run tools/generate-sprite.js to refresh sprite image
generate-sprite.js requires ImageMagick to be installed and works only in Windows (Linux and Apple users can run in VM)
Before running generate-sprite.js for the first time, check its source code and correct line 16 (var imagemagick = '<...>';) to point to ImageMagick install dir.
There is sh script for generating sprites
http://code.google.com/p/openid-selector/source/browse/trunk/generate-sprite.sh?r=115
USAGE:
1. Go to tools dir: [user@localhost home] cd /path/to/tools/directory
2. Run generating script: [user@localhost tools] sh generate-sprite.sh en
3. After generating, please remove sprite-generators dir from project
First row - big images one by one 60x100px
Second row - as I knew one by one 24x24px
Glue images like in examples
openid-selector code is licenced under the New BSD License.
Total 4 comments
This extension merely allows the user to pick (graphically) which OpenID provider they would like to use, and then passes that as a parameter to your lightopenid wrapper (yii extension LOID and COpenId are used for lightopenid) however you're logging in.
In my case, I extended the UserIdentity class, and created a new method called loginOpenId, which gets passed the authenticated user id from COpenId.
Flow: simpleopenidselector passes selected provider -> COpenId or LOID authenticates user and passes authenticated identity -> UserIdentity logs user in and authorizes access
can I use lightOpenId? Do I need to modify user module? (I use this module for login and register)
Hmm... Downloaded and unzipped successfully.
unzip file error. Only the folds was unzipped.
Leave a comment
Please login to leave your comment.