autogenerated usernames registered with OpenID can be changed; Google, Yahoo and...
[living-lab-site.git] / application / views / user / login_view.php
index 265672b..3d3aaa0 100644 (file)
 <fieldset>
        <legend><?php echo $this->lang->line('user_legend_login_openid') ?></legend>
        
+       <!--<p></p>-->
+       <p>
+               <a class="login-openid" data-op="google" href="#">Google</a>
+               <a class="login-openid" data-op="yahoo" href="#">Yahoo!</a>
+               <a class="login-openid" data-op="myopenid" href="#">myOpenID</a>
+       </p>
+       
        <table class="form">
                <tr>
                        <th><?php echo $this->lang->line('user_openid'). ': ' ?></th>
                </tr>
        </table>
 </fieldset>
-</form>
\ No newline at end of file
+</form>
+
+<script type="text/javascript">
+       $(function() {
+               $('.login-openid')
+                       .click(function() {
+                               var openId;
+                               
+                               console.log($(this).data('op'));
+                               
+                               switch ($(this).data('op'))
+                               {
+                               case 'google':
+                                       openId = 'https://www.google.com/accounts/o8/id';
+                                       break;
+                               case 'yahoo':
+                                       openId = 'https://me.yahoo.com/';
+                                       break;
+                               case 'myopenid':
+                                       openId = 'https://myopenid.com/';
+                                       break;
+                               }
+                               
+                               $.post('<?php echo site_url('user/login') ?>',
+                                               {'openid': openId},
+                                               function(text) {
+                                                       document.open();
+                                                       document.write(text);
+                                                       document.close();
+                                               });
+                       })
+                       .button();
+               
+       });
+</script>
\ No newline at end of file