Plugin Directory

Changeset 538512


Ignore:
Timestamp:
05/01/2012 02:01:18 PM (14 years ago)
Author:
VanillaForums
Message:

Fixed SSO admin.

Location:
vanilla-forums/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • vanilla-forums/trunk/admin.php

    r529910 r538512  
    162162<?php
    163163}
     164
     165/**
     166 * Single Sign-on administration page.
     167 */
     168function vf_sso_admin_page() {
     169    if (!current_user_can('manage_options'))
     170        wp_die(__('You do not have sufficient permissions to access this page.'));
     171 
     172    $options = get_option(VF_OPTIONS_NAME);
     173    $sso_enabled = vf_get_value('sso-enabled', $options, '');
     174    $sso_clientid = vf_get_value('sso-clientid', $options, vf_format_url(get_option('blogname')));
     175    $sso_secret = vf_get_value('sso-secret', $options, '');
     176    $vanilla_url = vf_get_value('url', $options);
     177?>
     178<style type="text/css">
     179.wrap strong {
     180    display: block;
     181    font-size: 14px;
     182}
     183.TextBox {
     184    width: 300px;
     185}
     186.form-container {
     187    background: #f0f0f0;
     188    display: block;
     189    max-width: 800px;
     190    padding: 10px;
     191    margin: 0 0 20px;
     192}
     193.form-container label {
     194    display: block;
     195    padding: 0 0 16px;
     196}
     197.form-container label:last-child {
     198    padding: 0;
     199}
     200.form-container span {
     201    display: block;
     202}
     203.info-container {
     204    background: #f0f0f0;
     205    display: block;
     206    max-width: 800px;
     207    padding: 10px;
     208}
     209.form-container label,
     210.info-container label {
     211    cursor: auto;
     212}
     213.CopyBox {
     214    font-size: 12px;
     215    border: 1px solid #ddd;
     216    background: #fff;
     217    padding: 3px 6px;
     218    font-family: monospace;
     219    margin-bottom: 10px;
     220    border-radius: 2px;
     221    -moz-border-radius: 2px;
     222    -webkit-border-radius: 2px;
     223}
     224.important {
     225    font-weight: bold;
     226    font-style: italic;
     227}
     228</style>
     229<script type="text/javascript">
     230jQuery(document).ready(function($) {
     231    $('.generate-secret').click(function() {
     232        $.ajax({
     233            url: $(this).attr('href'),
     234            success: function(data) {
     235                $('input.sso-secret').val(data);
     236            }
     237           
     238        });
     239        return false;
     240    });
     241});
     242</script>
     243<div class="wrap">
     244   <div id="icon-options-general" class="icon32"><br /></div>
     245   <h2><?php _e('Vanilla Single Sign-on Integration'); ?></h2>
     246    <?php vf_open_form('sso-form'); ?>
     247    <br />
     248    <strong>Security Settings for Single Sign-on</strong>
     249    <div class="form-container">
     250        <label>
     251            <strong>Enable</strong>
     252            <input type="checkbox" name="<?php echo vf_get_option_name('sso-enabled'); ?>" value="1"<?php echo $sso_enabled == '1' ? ' checked="checked"' : ''; ?> />
     253            Allow users to sign into Vanilla through WordPress.
     254        </label>
     255
     256        <label>
     257            <strong>Client ID</strong>
     258            <span>The client id is a url-friendly value that identifies your WordPress site to Vanilla.</span>
     259            <input class="TextBox" type="text" name="<?php echo vf_get_option_name('sso-clientid'); ?>" value="<?php echo $sso_clientid; ?>" />
     260        </label>
     261
     262        <label>
     263            <strong>Secret</strong>
     264            <span>This is a "secret" value that Vanilla uses to ensure that your WordPress site is a trusted source.</span>
     265            <input class="TextBox sso-secret" type="text" name="<?php echo vf_get_option_name('sso-secret'); ?>" value="<?php echo $sso_secret; ?>" />
     266            <a class="generate-secret" href="<?php echo site_url('?VFRequest=generate-secret'); ?>">Generate</a>
     267        </label>
     268    </div>
     269    <strong>Other information for Vanilla</strong>
     270    <div class="info-container">
     271        <label>
     272            <strong>Authenticate Url</strong>
     273            <div class="CopyBox"><?php echo site_url('?VFRequest=connect'); ?></div>
     274        </label>
     275        <label>
     276            <strong>Sign In Url</strong>
     277            <div class="CopyBox"><?php echo wp_login_url(); ?>?redirect_to={Redirect}</div>
     278        </label>
     279        <label>
     280            <strong>Register Url</strong>
     281            <div class="CopyBox"><?php echo site_url('wp-login.php?action=register', 'login'); ?></div>
     282        </label>
     283    </div>
     284
     285    <p class="important">Make sure that <u>all</u> of the values above are copied into <a href="<?php echo vf_combine_paths(array($vanilla_url, 'dashboard/settings/jsconnect')); ?>">your Vanilla jsConnect settings page</a>.</p>
     286
     287   <p class="submit"><input type="submit" name="save" value="<?php _e('Save Changes'); ?>" /></p>
     288    </form>
     289</div>
     290<?php
     291/*
     292 May need this value in the future...
     293            <th>Sign-out Url</th>
     294            <td><span class="description"><?php
     295                echo add_query_arg(array('action' => 'logout', '_wpnonce' => '{Nonce}', 'redirect_to' => '{Redirect}'), site_url('wp-login.php', 'login'));
     296            ?></span></td>
     297*/
     298
     299}
  • vanilla-forums/trunk/plugin.php

    r538201 r538512  
    44Plugin URI: http://vanillaforums.org/addons/
    55Description: Integrates Vanilla Forums with Wordpress: embedded blog comments, embedded forum, single sign on, and Wordpress widgets.
    6 Version: 1.1.9
     6Version: 1.1.10
    77Author: Mark O'Sullivan
    88Author URI: http://www.vanillaforums.org/
     
    48481.1.9
    4949- Made the sso pluggable.
     501.1.10
     51- Fixed sso admin page.
    5052
    5153Copyright 2010 Vanilla Forums Inc
  • vanilla-forums/trunk/readme.txt

    r538201 r538512  
    44Requires at least: 3
    55Tested up to: 3.3.1
    6 Stable tag: 1.1.9
     6Stable tag: 1.1.10
    77
    88== Description ==
  • vanilla-forums/trunk/sso.php

    r534888 r538512  
    2626        break;
    2727}
    28 
    29 /**
    30  * Single Sign-on administration page.
    31  */
    32 function vf_sso_admin_page() {
    33     if (!current_user_can('manage_options'))
    34         wp_die(__('You do not have sufficient permissions to access this page.'));
    35  
    36     $options = get_option(VF_OPTIONS_NAME);
    37     $sso_enabled = vf_get_value('sso-enabled', $options, '');
    38     $sso_clientid = vf_get_value('sso-clientid', $options, vf_format_url(get_option('blogname')));
    39     $sso_secret = vf_get_value('sso-secret', $options, '');
    40     $vanilla_url = vf_get_value('url', $options);
    41 ?>
    42 <style type="text/css">
    43 .wrap strong {
    44     display: block;
    45     font-size: 14px;
    46 }
    47 .TextBox {
    48     width: 300px;
    49 }
    50 .form-container {
    51     background: #f0f0f0;
    52     display: block;
    53     max-width: 800px;
    54     padding: 10px;
    55     margin: 0 0 20px;
    56 }
    57 .form-container label {
    58     display: block;
    59     padding: 0 0 16px;
    60 }
    61 .form-container label:last-child {
    62     padding: 0;
    63 }
    64 .form-container span {
    65     display: block;
    66 }
    67 .info-container {
    68     background: #f0f0f0;
    69     display: block;
    70     max-width: 800px;
    71     padding: 10px;
    72 }
    73 .form-container label,
    74 .info-container label {
    75     cursor: auto;
    76 }
    77 .CopyBox {
    78     font-size: 12px;
    79     border: 1px solid #ddd;
    80     background: #fff;
    81     padding: 3px 6px;
    82     font-family: monospace;
    83     margin-bottom: 10px;
    84     border-radius: 2px;
    85     -moz-border-radius: 2px;
    86     -webkit-border-radius: 2px;
    87 }
    88 .important {
    89     font-weight: bold;
    90     font-style: italic;
    91 }
    92 </style>
    93 <script type="text/javascript">
    94 jQuery(document).ready(function($) {
    95     $('.generate-secret').click(function() {
    96         $.ajax({
    97             url: $(this).attr('href'),
    98             success: function(data) {
    99                 $('input.sso-secret').val(data);
    100             }
    101            
    102         });
    103         return false;
    104     });
    105 });
    106 </script>
    107 <div class="wrap">
    108    <div id="icon-options-general" class="icon32"><br /></div>
    109    <h2><?php _e('Vanilla Single Sign-on Integration'); ?></h2>
    110     <?php vf_open_form('sso-form'); ?>
    111     <br />
    112     <strong>Security Settings for Single Sign-on</strong>
    113     <div class="form-container">
    114         <label>
    115             <strong>Enable</strong>
    116             <input type="checkbox" name="<?php echo vf_get_option_name('sso-enabled'); ?>" value="1"<?php echo $sso_enabled == '1' ? ' checked="checked"' : ''; ?> />
    117             Allow users to sign into Vanilla through WordPress.
    118         </label>
    119 
    120         <label>
    121             <strong>Client ID</strong>
    122             <span>The client id is a url-friendly value that identifies your WordPress site to Vanilla.</span>
    123             <input class="TextBox" type="text" name="<?php echo vf_get_option_name('sso-clientid'); ?>" value="<?php echo $sso_clientid; ?>" />
    124         </label>
    125 
    126         <label>
    127             <strong>Secret</strong>
    128             <span>This is a "secret" value that Vanilla uses to ensure that your WordPress site is a trusted source.</span>
    129             <input class="TextBox sso-secret" type="text" name="<?php echo vf_get_option_name('sso-secret'); ?>" value="<?php echo $sso_secret; ?>" />
    130             <a class="generate-secret" href="<?php echo site_url('?VFRequest=generate-secret'); ?>">Generate</a>
    131         </label>
    132     </div>
    133     <strong>Other information for Vanilla</strong>
    134     <div class="info-container">
    135         <label>
    136             <strong>Authenticate Url</strong>
    137             <div class="CopyBox"><?php echo site_url('?VFRequest=connect'); ?></div>
    138         </label>
    139         <label>
    140             <strong>Sign In Url</strong>
    141             <div class="CopyBox"><?php echo wp_login_url(); ?>?redirect_to={Redirect}</div>
    142         </label>
    143         <label>
    144             <strong>Register Url</strong>
    145             <div class="CopyBox"><?php echo site_url('wp-login.php?action=register', 'login'); ?></div>
    146         </label>
    147     </div>
    148 
    149     <p class="important">Make sure that <u>all</u> of the values above are copied into <a href="<?php echo vf_combine_paths(array($vanilla_url, 'dashboard/settings/jsconnect')); ?>">your Vanilla jsConnect settings page</a>.</p>
    150 
    151    <p class="submit"><input type="submit" name="save" value="<?php _e('Save Changes'); ?>" /></p>
    152     </form>
    153 </div>
    154 <?php
    155 /*
    156  May need this value in the future...
    157             <th>Sign-out Url</th>
    158             <td><span class="description"><?php
    159                 echo add_query_arg(array('action' => 'logout', '_wpnonce' => '{Nonce}', 'redirect_to' => '{Redirect}'), site_url('wp-login.php', 'login'));
    160             ?></span></td>
    161 */
    162 
    163 }
Note: See TracChangeset for help on using the changeset viewer.