Plugin Directory

Changeset 1788237


Ignore:
Timestamp:
12/17/2017 10:09:41 AM (8 years ago)
Author:
authentiq
Message:

Preparing for 1.0.3 release

Location:
authentiq/trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • authentiq/trunk/CHANGELOG.txt

    r1775125 r1788237  
    11== Changelog ==
     2
     3= 1.0.3 - 2017-12-17 =
     4
     5* Feature - Stop updating username and display_name on sub-sequent signins.
     6* Feature - Add settings for defining a specific redirect URL after signin.
    27
    38= 1.0.2 - 2017-11-25 =
  • authentiq/trunk/README.txt

    r1775125 r1788237  
    44Requires at least: 4.6
    55Tested up to: 4.9
    6 Stable tag: 1.0.2
     6Stable tag: 1.0.3
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    112112== Changelog ==
    113113
     114= 1.0.3 - 2017-12-17 =
     115
     116* Feature - Stop updating username and display_name on sub-sequent signins.
     117* Feature - Add settings for defining a specific redirect URL after signin.
     118
    114119= 1.0.2 - 2017-11-25 =
    115120
  • authentiq/trunk/admin/partials/authentiq-settings.php

    r1756312 r1788237  
    102102                    <input type="text" name="authentiq_settings[client_id]" id="authentiq_settings[client_id]"
    103103                           value="<?php echo esc_attr($this->options->get('client_id')); ?>" class="regular-text">
    104 
    105104                </td>
    106105            </tr>
     
    114113                           value="<?php echo esc_attr($this->options->get('client_secret')); ?>"
    115114                           class="regular-text">
    116 
    117115                </td>
    118116            </tr>
     
    216214                </td>
    217215            </tr>
    218             </tbody>
    219         </table>
    220 
    221         <h2><?php esc_html_e('Domain filter', AUTHENTIQ_LANG) ?></h2>
    222         <table class="form-table">
    223             <tbody>
     216
     217            <tr>
     218                <th scope="row">
     219                    <label for="authentiq_settings[default_login_redirection]"><?php esc_html_e('Page after login', AUTHENTIQ_LANG) ?></label>
     220                </th>
     221                <td valign="center">
     222                    <input type="text" name="authentiq_settings[default_login_redirection]"
     223                           id="authentiq_settings[default_login_redirection]"
     224                           value="<?php echo esc_attr($this->options->get('default_login_redirection')); ?>"
     225                           placeholder="<?php esc_html_e('no redirect', AUTHENTIQ_LANG) ?>"
     226                           class="regular-text">
     227
     228                    <?php esc_html_e('for', AUTHENTIQ_LANG) ?>
     229
     230                    <?php $default_login_redirection_applies_to = $this->options->get('default_login_redirection_applies_to'); ?>
     231
     232                    <label for="authentiq_settings[default_login_redirection_applies_to]">
     233                        <select name="authentiq_settings[default_login_redirection_applies_to]"
     234                                id="authentiq_settings[default_login_redirection_applies_to]">
     235                            <option value="all" <?php selected($default_login_redirection_applies_to, 'all'); ?>>
     236                                <?php esc_html_e('All users', AUTHENTIQ_LANG) ?>
     237                            </option>
     238                            <?php wp_dropdown_roles($default_login_redirection_applies_to); ?>
     239                        </select>
     240                    </label>
     241                </td>
     242            </tr>
     243
    224244            <tr>
    225245                <th scope="row"><label
  • authentiq/trunk/authentiq.php

    r1775003 r1788237  
    44 * Plugin URI:        https://wordpress.org/plugins/authentiq
    55 * Description:       Sign in (and sign up) to WordPress sites using the Authentiq ID app. Strong authentication, without the passwords.
    6  * Version:           1.0.2
     6 * Version:           1.0.3
    77 * Author:            The Authentiq Team
    88 * Author URI:        https://www.authentiq.com
     
    2121define('AUTHENTIQ_PLUGIN_DIR', trailingslashit(plugin_dir_path(__FILE__)));
    2222define('AUTHENTIQ_PLUGIN_URL', trailingslashit(plugin_dir_url(__FILE__)));
    23 define('AUTHENTIQ_VERSION', '1.0.2');
     23define('AUTHENTIQ_VERSION', '1.0.3');
    2424define('AUTHENTIQ_NAME', 'authentiq');
    2525define('AUTHENTIQ_LANG', AUTHENTIQ_NAME);
  • authentiq/trunk/includes/class-authentiq-options.php

    r1775003 r1788237  
    116116
    117117            // Default redirect_to after a sign-in for Authentiq plugin
    118             'default_login_redirection' => home_url(),
     118            'default_login_redirection' => '',
     119            'default_login_redirection_applies_to' => 'all',
    119120
    120121            // Used for showing messages in the admin area
  • authentiq/trunk/includes/class-authentiq-provider.php

    r1775003 r1788237  
    6060
    6161    public static function get_authorize_url($extra_scopes = array()) {
     62        global $wp;
    6263
    6364        $options = Authentiq_Options::Instance();
     
    9495
    9596        // Pass redirect_to with state, in order we can redirect back after sign-in
    96         $redirect_to = get_permalink();
     97        $redirect_to = home_url(add_query_arg(array(), $wp->request));
    9798        if (!empty($redirect_to)) {
    9899            $state_obj['redirect_to'] = $redirect_to;
     
    273274            // Perform user login to WP
    274275            if ($user) {
    275                 // Default redirect URL for Authentiq
    276                 $redirect_to = $this->options->get('default_login_redirection', home_url());
    277 
    278                 if (isset($_REQUEST['redirect_to']) && !empty($_REQUEST['redirect_to'])) {
    279                     $redirect_to = $_REQUEST['redirect_to'];
    280 
    281                 } else if (isset($state_obj['redirect_to']) && !empty($state_obj['redirect_to'])) {
    282                     $redirect_to = $state_obj['redirect_to'];
     276                // check if a redirect URL is set and user role meets the condition to redirect the page
     277                $default_login_redirection_applies_to = $this->options->get('default_login_redirection_applies_to');
     278                if ($default_login_redirection_applies_to === 'all'
     279                    || in_array($default_login_redirection_applies_to, (array)$user->roles)) {
     280                    $redirect_to = $this->options->get('default_login_redirection');
     281                }
     282
     283                if (empty($redirect_to)) {
     284                    // Default redirect URL to frontend home page
     285                    $redirect_to = home_url();
     286
     287                    // if user is admin, then move to the admin area
     288                    if (is_super_admin($user->ID)) {
     289                        $redirect_to = admin_url();
     290                    }
     291
     292                    if (isset($_REQUEST['redirect_to']) && !empty($_REQUEST['redirect_to'])) {
     293                        $redirect_to = $_REQUEST['redirect_to'];
     294
     295                    } else if (isset($state_obj['redirect_to']) && !empty($state_obj['redirect_to'])) {
     296                        $redirect_to = $state_obj['redirect_to'];
     297                    }
    283298                }
    284299
  • authentiq/trunk/includes/class-authentiq-user.php

    r1775003 r1788237  
    2121     * @return array
    2222     */
    23     private static function get_user_data_from_userinfo($userinfo) {
    24         $email = null;
     23    private static function get_user_data_from_userinfo($userinfo, $update = false) {
     24        // Create the user data array for updating WP user info
     25        $userdata = array();
     26
    2527        if (isset($userinfo->email) && is_email($userinfo->email)) {
    2628            $email = sanitize_email($userinfo->email);
    27         }
    28 
    29         $first_name = null;
    30         $last_name = null;
    31         $user_name = null;
    32         $display_name = null;
     29            $userdata['user_email'] = $email;
     30        }
    3331
    3432        // Try to get username from Authentiq ID, when set
    3533        if (isset($userinfo->preferred_username)) {
    36             $user_name = $userinfo->preferred_username;
    37             $display_name = $user_name;
    38         }
    39 
    40         if (!$display_name && isset($userinfo->name)) {
    41             $display_name = $userinfo->name;
     34            $preferred_username = trim($userinfo->preferred_username);
     35
     36            // only set nickname on user creation
     37            if (!$update) {
     38                $userdata['nickname'] = $preferred_username;
     39            }
     40
     41            // default user_login is the $preferred_username
     42            $userdata['user_login'] = $preferred_username;
     43        }
     44
     45        // if no user_login set so far, try to set one using the email
     46        if (!isset($userdata['user_login']) && $userdata['user_email']) {
     47            $email_parts = explode('@', $userdata['user_email']);
     48            $userdata['user_login'] = $email_parts[0];
    4249        }
    4350
    4451        if (isset($userinfo->given_name)) {
    45             $first_name = $userinfo->given_name;
    46 
    47             if (!$user_name) $user_name = strtolower($first_name);
     52            $first_name = trim($userinfo->given_name);
     53            $userdata['first_name'] = $first_name;
     54
     55            // if no user_login set, then use the first_name
     56            $userdata['user_login'] = !empty($userdata['user_login']) ? $userdata['user_login'] : strtolower($first_name);
    4857        }
    4958
    5059        if (isset($userinfo->family_name)) {
    51             $last_name = $userinfo->family_name;
     60            $userdata['last_name'] = $userinfo->family_name;
    5261        }
    5362
     
    5564        // as a fallback remove non english chars, so as email name can be used
    5665        // with //translit you get a meaningful conversion to ASCII (e.g. ß -> ss)
    57         $user_name = iconv('UTF-8', 'ASCII//TRANSLIT', $user_name);
    58 
    59         // if no username set so far, try to set one using the email
    60         if (!$user_name) {
    61             $email_parts = explode('@', $email);
    62             $user_name = $email_parts[0];
    63         }
    64 
    65         // Create the user data array for updating WP user info
    66         $user_data = array(
    67             'user_email' => trim($email),
    68             'user_login' => trim($user_name),
    69             'first_name' => trim($first_name),
    70             'last_name' => trim($last_name),
    71             'display_name' => trim($display_name),
    72             'nickname' => trim($user_name),
    73         );
    74 
    75         return $user_data;
     66        if ($userdata['user_login']) {
     67            $userdata['user_login'] = iconv('UTF-8', 'ASCII//TRANSLIT', $userdata['user_login']);
     68        }
     69
     70        return $userdata;
    7671    }
    7772
     
    8378     * @return array
    8479     */
    85     private static function get_authentiq_userinfo($userinfo) {
    86         $user_data = array();
     80    private static function get_authentiq_userinfo($userinfo, $update = false) {
     81        $userdata = array();
    8782
    8883        if (isset($userinfo->phone_number)) {
    89             $user_data['phone_number'] = $userinfo->phone_number;
     84            $userdata['phone_number'] = trim($userinfo->phone_number);
    9085
    9186            if (isset($userinfo->phone_number_verified)) {
    92                 $user_data['phone_number_verified'] = $userinfo->phone_number_verified;
     87                $userdata['phone_number_verified'] = $userinfo->phone_number_verified;
    9388            }
    9489
    9590            if (isset($userinfo->phone_type)) {
    96                 $user_data['phone_type'] = $userinfo->phone_type;
     91                $userdata['phone_type'] = trim($userinfo->phone_type);
    9792            }
    9893        }
    9994
    10095        if (isset($userinfo->address)) {
    101             $user_data['address'] = (array)$userinfo->address;
     96            $userdata['address'] = (array)$userinfo->address;
    10297        }
    10398
    10499        $twitter_scope = 'aq:social:twitter';
    105100        if (isset($userinfo->$twitter_scope)) {
    106             $user_data['twitter'] = (array)$userinfo->$twitter_scope;
     101            $userdata['twitter'] = (array)$userinfo->$twitter_scope;
    107102        }
    108103
    109104        $facebook_scope = 'aq:social:facebook';
    110105        if (isset($userinfo->$facebook_scope)) {
    111             $user_data['facebook'] = (array)$userinfo->$facebook_scope;
     106            $userdata['facebook'] = (array)$userinfo->$facebook_scope;
    112107        }
    113108
    114109        $linkedin_scope = 'aq:social:linkedin';
    115110        if (isset($userinfo->$linkedin_scope)) {
    116             $user_data['linkedin'] = (array)$userinfo->$linkedin_scope;
    117         }
    118 
    119         return $user_data;
     111            $userdata['linkedin'] = (array)$userinfo->$linkedin_scope;
     112        }
     113
     114        return $userdata;
    120115    }
    121116
     
    129124     */
    130125    public static function create_user($userinfo) {
    131         // Get WP user info from Authentiq userinfo
    132         $user_data = Authentiq_User::get_user_data_from_userinfo($userinfo);
    133 
    134126        // FIXME: check if email is required
    135127        if (empty($userinfo->email)) {
     
    137129            throw new Authentiq_User_Creation_Failed_Exception($msg);
    138130        }
     131
     132        // Get WP user info from Authentiq userinfo
     133        $user_data = Authentiq_User::get_user_data_from_userinfo($userinfo);
    139134
    140135        // Generate a random password, otherwise account creation fails
     
    224219
    225220        // Get WP user info from Authentiq userinfo
    226         $user_data = Authentiq_User::get_user_data_from_userinfo($userinfo);
     221        $user_data = Authentiq_User::get_user_data_from_userinfo($userinfo, true);
    227222
    228223        /**
     
    258253
    259254        // Add Authentiq extra info to WP user profile
    260         $authentiq_userinfo = Authentiq_User::get_authentiq_userinfo($userinfo);
     255        $authentiq_userinfo = Authentiq_User::get_authentiq_userinfo($userinfo, false);
    261256        if (!empty($authentiq_userinfo)) {
    262257            Authentiq_User::update_userinfo($user_id, $authentiq_userinfo);
  • authentiq/trunk/includes/class-authentiq-widget.php

    r1754859 r1788237  
    137137
    138138    public function get_logged_in_template($instance) {
    139         $redirect_to = get_permalink();
     139        global $wp;
     140
     141        $redirect_to = home_url(add_query_arg(array(), $wp->request));
    140142        $logout_url = wp_logout_url($redirect_to);
    141143
  • authentiq/trunk/languages/authentiq-en_US.po

    r1756312 r1788237  
    22msgstr ""
    33"Project-Id-Version: authentiq\n"
    4 "POT-Creation-Date: 2017-10-31 23:37+0200\n"
    5 "PO-Revision-Date: 2017-10-31 23:37+0200\n"
     4"POT-Creation-Date: 2017-12-17 12:02+0200\n"
     5"PO-Revision-Date: 2017-12-17 12:02+0200\n"
    66"Last-Translator: \n"
    77"Language-Team: Authentiq team <hello@authentiq.com>\n"
     
    5858msgstr ""
    5959
    60 #: admin/partials/authentiq-settings.php:109
     60#: admin/partials/authentiq-settings.php:108
    6161msgid "Client Secret"
    6262msgstr ""
    6363
     64#: admin/partials/authentiq-settings.php:119
     65msgid "Requested scopes"
     66msgstr ""
     67
    6468#: admin/partials/authentiq-settings.php:121
    65 msgid "Requested scopes"
    66 msgstr ""
    67 
    68 #: admin/partials/authentiq-settings.php:123
    6969msgid "Additional scopes requested from Authentiq ID on user sign in."
    7070msgstr ""
    7171
    72 #: admin/partials/authentiq-settings.php:132
     72#: admin/partials/authentiq-settings.php:130
    7373#: admin/partials/authentiq-user-profile.php:43
    7474msgid "Phone number"
    7575msgstr ""
    7676
    77 #: admin/partials/authentiq-settings.php:141
     77#: admin/partials/authentiq-settings.php:139
    7878#: admin/partials/authentiq-user-profile.php:58
    7979msgid "Address"
    8080msgstr ""
    8181
    82 #: admin/partials/authentiq-settings.php:151
     82#: admin/partials/authentiq-settings.php:149
    8383#: admin/partials/authentiq-user-profile.php:69
    8484msgid "Twitter"
    8585msgstr ""
    8686
    87 #: admin/partials/authentiq-settings.php:161
     87#: admin/partials/authentiq-settings.php:159
    8888#: admin/partials/authentiq-user-profile.php:82
    8989msgid "Facebook"
    9090msgstr ""
    9191
    92 #: admin/partials/authentiq-settings.php:171
     92#: admin/partials/authentiq-settings.php:169
    9393msgid "Linkedin"
    9494msgstr ""
    9595
    96 #: admin/partials/authentiq-settings.php:179
     96#: admin/partials/authentiq-settings.php:177
    9797msgid "Functionality"
    9898msgstr ""
    9999
    100 #: admin/partials/authentiq-settings.php:184
     100#: admin/partials/authentiq-settings.php:182
    101101msgid "Classic WordPress Login"
    102102msgstr ""
    103103
    104 #: admin/partials/authentiq-settings.php:192
     104#: admin/partials/authentiq-settings.php:190
    105105msgid "Allow"
    106106msgstr ""
    107107
    108 #: admin/partials/authentiq-settings.php:200
     108#: admin/partials/authentiq-settings.php:198
    109109msgid "all users"
    110110msgstr ""
    111111
    112 #: admin/partials/authentiq-settings.php:201
     112#: admin/partials/authentiq-settings.php:199
    113113msgid "users without Authentiq ID"
    114114msgstr ""
    115115
    116 #: admin/partials/authentiq-settings.php:204
     116#: admin/partials/authentiq-settings.php:202
    117117msgid "to sign in with username and password."
    118118msgstr ""
    119119
    120 #: admin/partials/authentiq-settings.php:214
     120#: admin/partials/authentiq-settings.php:212
    121121msgid ""
    122122"Skip the WordPress login page, and proceed directly to Authentiq sign in."
    123123msgstr ""
    124124
    125 #: admin/partials/authentiq-settings.php:221
    126 msgid "Domain filter"
    127 msgstr ""
    128 
    129 #: admin/partials/authentiq-settings.php:226
     125#: admin/partials/authentiq-settings.php:219
     126msgid "Page after login"
     127msgstr ""
     128
     129#: admin/partials/authentiq-settings.php:225
     130msgid "no redirect"
     131msgstr ""
     132
     133#: admin/partials/authentiq-settings.php:228
     134msgid "for"
     135msgstr ""
     136
     137#: admin/partials/authentiq-settings.php:236
     138msgid "All users"
     139msgstr ""
     140
     141#: admin/partials/authentiq-settings.php:246
    130142msgid "Domains to filter"
    131143msgstr ""
    132144
    133 #: admin/partials/authentiq-settings.php:235
     145#: admin/partials/authentiq-settings.php:255
    134146msgid "Only"
    135147msgstr ""
    136148
    137 #: admin/partials/authentiq-settings.php:236
     149#: admin/partials/authentiq-settings.php:256
    138150msgid "No"
    139151msgstr ""
    140152
    141 #: admin/partials/authentiq-settings.php:239
     153#: admin/partials/authentiq-settings.php:259
    142154msgid "Users from the following domains are allowed."
    143155msgstr ""
    144156
    145 #: admin/partials/authentiq-settings.php:280
     157#: admin/partials/authentiq-settings.php:300
    146158#: admin/partials/authentiq-user-profile.php:135
    147159msgid "Please try again."
     
    184196msgstr ""
    185197
    186 #: includes/class-authentiq-provider.php:219
     198#: includes/class-authentiq-provider.php:220
    187199msgid ""
    188200"Error: Your Authentiq Client ID has not set in the Authentiq plugin settings."
    189201msgstr ""
    190202
    191 #: includes/class-authentiq-provider.php:223
     203#: includes/class-authentiq-provider.php:224
    192204msgid ""
    193205"Error: Your Authentiq Client Secret has not set in the Authentiq plugin "
     
    195207msgstr ""
    196208
    197 #: includes/class-authentiq-provider.php:251
     209#: includes/class-authentiq-provider.php:252
    198210msgid "Error: There was an issue decoding the id_token."
    199211msgstr ""
    200212
    201 #: includes/class-authentiq-provider.php:287
    202 #: includes/class-authentiq-provider.php:305
     213#: includes/class-authentiq-provider.php:314
     214#: includes/class-authentiq-provider.php:332
    203215msgid "Failed to login using Authentiq."
    204216msgstr ""
    205217
    206 #: includes/class-authentiq-provider.php:292
     218#: includes/class-authentiq-provider.php:319
    207219msgid ""
    208220"Error: the Client Secret configured on the Authentiq plugin is wrong. Make "
     
    210222msgstr ""
    211223
    212 #: includes/class-authentiq-provider.php:424
     224#: includes/class-authentiq-provider.php:451
    213225#, php-format
    214226msgid "This email domain (%s) is not allowed by site administrator."
    215227msgstr ""
    216228
    217 #: includes/class-authentiq-provider.php:433
     229#: includes/class-authentiq-provider.php:460
    218230#, php-format
    219231msgid "This email domain (%s) is not whitelisted by site administrator."
    220232msgstr ""
    221233
    222 #: includes/class-authentiq-provider.php:465
     234#: includes/class-authentiq-provider.php:492
    223235msgid "Please set an email at AuthentiqID App."
    224236msgstr ""
    225237
    226 #: includes/class-authentiq-provider.php:470
     238#: includes/class-authentiq-provider.php:497
    227239msgid "Please verify the email used at AuthentiqID App."
    228240msgstr ""
    229241
    230 #: includes/class-authentiq-provider.php:495
     242#: includes/class-authentiq-provider.php:522
    231243msgid "This Authentiq ID is already linked to another WordPress user."
    232244msgstr ""
    233245
    234 #: includes/class-authentiq-provider.php:503
     246#: includes/class-authentiq-provider.php:530
    235247msgid "Current WordPress user is already linked with another Authentiq ID."
    236248msgstr ""
    237249
    238 #: includes/class-authentiq-provider.php:549
     250#: includes/class-authentiq-provider.php:576
    239251msgid "Failed to create WordPress user"
    240252msgstr ""
    241253
    242 #: includes/class-authentiq-provider.php:555
     254#: includes/class-authentiq-provider.php:582
    243255msgid "User registration is not allowed by site adminitrator."
    244256msgstr ""
    245257
    246 #: includes/class-authentiq-provider.php:644
    247 #: includes/class-authentiq-provider.php:664
     258#: includes/class-authentiq-provider.php:671
     259#: includes/class-authentiq-provider.php:691
    248260msgid "Passwords have been disabled. Try to login with Authentiq."
    249261msgstr ""
    250262
    251 #: includes/class-authentiq-provider.php:658
     263#: includes/class-authentiq-provider.php:685
    252264msgid ""
    253265"You have already linked your account with Authentiq ID. Please use Authentiq "
     
    255267msgstr ""
    256268
    257 #: includes/class-authentiq-provider.php:726
     269#: includes/class-authentiq-provider.php:753
    258270msgid ""
    259271"The Authentiq state parameter can not be verified. This may be due to this "
     
    262274msgstr ""
    263275
    264 #: includes/class-authentiq-user.php:136
     276#: includes/class-authentiq-user.php:128
    265277msgid "Email is required by your site administrator."
    266278msgstr ""
    267279
    268 #: includes/class-authentiq-user.php:198
     280#: includes/class-authentiq-user.php:216
    269281msgid "No user set to be updated."
    270282msgstr ""
     
    293305
    294306#: includes/class-authentiq-widget.php:50
    295 #: includes/class-authentiq-widget.php:144
     307#: includes/class-authentiq-widget.php:146
    296308#: public/partials/logged-in-state.php:3
    297309msgid "Sign out"
     
    315327
    316328#: public/class-authentiq-public.php:112 public/class-authentiq-public.php:151
    317 #: public/class-authentiq-public.php:194
     329#: public/class-authentiq-public.php:196
    318330msgid "Please visit the Authentiq plugin settings and configure the client."
    319331msgstr ""
  • authentiq/trunk/public/class-authentiq-public.php

    r1756312 r1788237  
    191191
    192192    function render_logged_in_state($sign_out_text = null) {
     193        global $wp;
     194
    193195        if (!$this->options->is_configured()) {
    194196            $msg = __('Please visit the Authentiq plugin settings and configure the client.', AUTHENTIQ_LANG);
     
    198200        }
    199201
    200         $redirect_to = get_permalink();
     202        $redirect_to = home_url(add_query_arg(array(),$wp->request));
    201203        $logout_url = wp_logout_url($redirect_to);
    202204
  • authentiq/trunk/public/js/authentiq-public.min.js

    r1775003 r1788237  
    11/*!
    2  * Authentiq WordPress plugin - v1.0.2
     2 * Authentiq WordPress plugin - v1.0.3
    33 *
    44 * Authentiq
Note: See TracChangeset for help on using the changeset viewer.