Plugin Directory

Changeset 3095291


Ignore:
Timestamp:
05/30/2024 05:14:11 PM (20 months ago)
Author:
Hakik
Message:

v1.0.3: Security: Temporary users are not allowed to access the User/Profile menu, Tweak: dmin_init was changed with wp_dashboard_setup to control capabilities and admin menu, Appearance: Fixed the outline style of the delete button and added a tooltip for clear instruction.

Location:
create-temporary-login
Files:
16 added
7 edited

Legend:

Unmodified
Added
Removed
  • create-temporary-login/trunk/admin/css/admin.css

    r3083509 r3095291  
    102102.ctl_tokens li a.ctl_token:first-child {
    103103    padding: 5px;
    104     display: inline-block;
     104    display: block;
    105105    border: 1px dashed #3c434a;
    106106    text-decoration: none;
     
    132132}
    133133
     134.ctl_tokens li a.ctl_delete_link {
     135    display: block;
     136}
     137
     138.ctl_tokens li a.ctl_delete_link:focus {
     139    box-shadow: inset 0px 0px 5px #730b0b;
     140    background-color: #a00;
     141    border-bottom-right-radius: 10px;
     142    border-top-left-radius: 10px;
     143}
     144
    134145
    135146.ctl_tokens li a.ctl_delete_link span{
     
    151162    display: inline-block;
    152163}
     164.ctl_token:before {
     165    content: attr(data-instruction);
     166    position: absolute;
     167    z-index: 1;
     168    visibility: hidden;
     169    width: 120px;
     170    background-color: black;
     171    color: #fff;
     172    text-align: center;
     173    padding: 5px 10px;
     174    border-radius: 6px;
     175    font-size: 11px;
     176    top: -36px;
     177    left: 50%;
     178    margin-left: -60px;
     179}
     180.ctl_token:after {
     181    content: " ";
     182    position: absolute;
     183    visibility: hidden;
     184    top: -8px;
     185    left: 50%;
     186    margin-left: -5px;
     187    border-width: 5px;
     188    border-style: solid;
     189    border-color: black transparent transparent transparent;
     190}
     191
     192.ctl_token:hover:before,
     193.ctl_token:hover:after{
     194    visibility: visible;
     195}
  • create-temporary-login/trunk/create-temporary-login.php

    r3089036 r3095291  
    11<?php
    22/*
    3 Plugin Name:        Bifröst WP - Create Passwordless Temporary Login Links
     3Plugin Name:        WP Bifröst - Create Passwordless Temporary Login Links
    44Plugin URI:         https://wordpress.org/plugins/create-temporary-login
    55Description:        Create passwordless temporary login links to easily give access to your site's dashboard.
    6 Version:            1.0.2
     6Version:            1.0.3
    77Author:             Hakik Zaman
    88Author URI:         https://profiles.wordpress.org/users/hakik 
     
    2121 */
    2222if ( ! defined( 'CTLAZ_TEMP_LOGIN_VERSION' ) ) {
    23     define( 'CTLAZ_TEMP_LOGIN_VERSION', '1.0.2' );
     23    define( 'CTLAZ_TEMP_LOGIN_VERSION', '1.0.3' );
    2424}
    2525
  • create-temporary-login/trunk/includes/class-admin.php

    r3089036 r3095291  
    100100    public function create_temporary_login(){
    101101
    102         echo "<h1>".esc_html__( 'Bifröst WP - Settings (Create Passwordless Temporary Login Links)', 'create-temporary-login' )."</h1>";
     102        echo "<h1>".esc_html__( 'WP Bifröst - Settings (Create Passwordless Temporary Login Links)', 'create-temporary-login' )."</h1>";
    103103        $other_attributes = array( 'tabindex' => '1' );
    104104        submit_button( __( 'Generate a link', 'create-temporary-login' ), 'secondary ctl_generate_link', '', true, $other_attributes );
     
    116116                $links .= sprintf(
    117117                    '<li>
    118                         <a class="ctl_token" data-url="%1$s">
     118                        <a class="ctl_token" data-url="%1$s" data-instruction="%10$s">
    119119                            <span class="dashicons dashicons-admin-links"></span>
    120120                            <span class="ctl_link">%1$s</span>
     
    136136                        </p>
    137137                    </li>',
    138                     // Token generated link to copy it to clipboard
     138                    // 1. Token generated link to copy it to clipboard
    139139                    esc_url( site_url('?ctl_token=') . get_user_meta( $user->ID, 'ctl_token', true ) ),
    140                     // Link of delete the link
     140                    // 2. Link of delete the link
    141141                    esc_url( wp_nonce_url( admin_url("users.php?page=create-temporary-login&user_id={$user->ID}"), 'ctl_delete_link', 'ctl_delete_link_nonce' ) ),
    142                     // Delete text
     142                    // 3. Delete text
    143143                    esc_html__( 'Delete', 'create-temporary-login' ),
    144                     // Copied text after clicking on link
     144                    // 4. Copied text after clicking on link
    145145                    esc_html__( 'Copied', 'create-temporary-login' ),
    146                     // Human readable time to show how many days are remaining
     146                    // 5. Human readable time to show how many days are remaining
    147147                    ctlaz_create_temporary_login()->get_option()->get_human_readable_link_duration( $user->ID ),
    148                     // Text of the Extend Button
     148                    // 6. Text of the Extend Button
    149149                    esc_html__( 'Extend 3 days', 'create-temporary-login' ),
    150                     // Link of extend time for the link
     150                    // 7. Link of extend time for the link
    151151                    esc_url( wp_nonce_url( admin_url("users.php?page=create-temporary-login&user_id={$user->ID}"), 'ctl_extend_link', 'ctl_extend_link_nonce' ) ),
    152                     // Add background color to red if link is expired
     152                    // 8. Add background color to red if link is expired
    153153                    ctlaz_create_temporary_login()->get_option()->is_user_expired( $user->ID ) ? 'ctl-danger' : '',
    154                     // Hide extend button if not expired
    155                     !ctlaz_create_temporary_login()->get_option()->is_user_expired( $user->ID ) ? 'ctl-display-none' : ''
     154                    // 9. Hide extend button if not expired
     155                    !ctlaz_create_temporary_login()->get_option()->is_user_expired( $user->ID ) ? 'ctl-display-none' : '',
     156                    // 10. Tooltip text
     157                    esc_html__( 'Click to Copy!', 'create-temporary-login' )
    156158
    157159                );
  • create-temporary-login/trunk/includes/class-option.php

    r3089036 r3095291  
    2929     */
    3030    public function set_hooks(){
    31         add_action( 'admin_init', array( $this, 'set_temporary_logged_in_user_permission' ), 10 );
     31        add_action( 'wp_dashboard_setup', array( $this, 'set_temporary_logged_in_user_permission' ), 10 );
    3232    }
    3333
     
    140140             * To print the available capabilities for this current user- `print_r($user->get_role_caps());`
    141141             */
     142            $user->add_cap( 'create_users', false );
     143            $user->add_cap( 'list_users', false );
    142144            $user->add_cap( 'delete_users', false );
    143145            /**
     
    146148             * remove_menu_page( 'users.php' );
    147149             */
     150            remove_menu_page( 'users.php' );
     151            remove_menu_page( 'profile.php' );
    148152        }
    149153       
  • create-temporary-login/trunk/languages/create-temporary-login.pot

    r3089036 r3095291  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Bifröst WP - Create Passwordless Temporary Login Links 1.0.2\n"
     5"Project-Id-Version: WP Bifröst - Create Passwordless Temporary Login Links 1.0.3\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/create-temporary-login\n"
    77"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2024-05-19T11:33:51+00:00\n"
     12"POT-Creation-Date: 2024-05-30T06:31:54+00:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: WP-CLI 2.9.0\n"
     
    1616
    1717#. Plugin Name of the plugin
    18 msgid "Bifröst WP - Create Passwordless Temporary Login Links"
     18msgid "WP Bifröst - Create Passwordless Temporary Login Links"
    1919msgstr ""
    2020
     
    3636
    3737#: includes/class-admin.php:102
    38 msgid "Bifröst WP - Settings (Create Passwordless Temporary Login Links)"
     38msgid "WP Bifröst - Settings (Create Passwordless Temporary Login Links)"
    3939msgstr ""
    4040
     
    5555msgstr ""
    5656
    57 #: includes/class-admin.php:247
     57#: includes/class-admin.php:157
     58msgid "Click to Copy!"
     59msgstr ""
     60
     61#: includes/class-admin.php:249
    5862msgid "Create Temporary Login"
    5963msgstr ""
    6064
    61 #: includes/class-admin.php:284
     65#: includes/class-admin.php:286
    6266msgid "<strong>Error:</strong> The username is not registered on this site. If you are unsure of your username, try your email address instead."
    6367msgstr ""
  • create-temporary-login/trunk/readme.txt

    r3089036 r3095291  
    1 === Bifröst WP - Create Passwordless Temporary Login Links ===
     1=== WP Bifröst - Create Passwordless Temporary Login Links ===
    22Contributors: Hakik
    33Tags: temporary login, passwordless login, temporary access, login
     
    55Requires at least: 6.2
    66Tested up to: 6.5
    7 Stable tag: 1.0.2
     7Stable tag: 1.0.3
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1313== Description ==
    1414
    15 Create Temporary Login helps you create secure passwordless links that allow instant access to your WordPress dashboard.
     15WP Bifröst helps you create secure passwordless links that allow instant access to your WordPress dashboard.
    1616
    1717=== How to Create Passwordless Temporary Login Links? ===
     
    4242Not to worry. The URL is automatically disabled at the expiration time with no action needed on your part.
    4343
     44== Screenshots ==
     45
     461. Direct link to create the temporary login link.
     472. Temporary Login submenu under the Users menu.
     483. Click on this 'Generate a link' button to generate a temporary login link.
     494. Click on the link to copy the link to the clipboard.
     505. Delete icon to remove the temporary login link.
     516. Extend the time for the link for 3 days.
     52
    4453== Changelog ==
     54
     55= 1.0.3 =
     56* Security: Temporary users are not allowed to access the User/Profile menu.
     57* Tweak: `admin_init` was changed with `wp_dashboard_setup` to control capabilities and admin menu.
     58* Appearance: Fixed the outline style of the delete button and added a tooltip for clear instruction.
    4559
    4660= 1.0.2 =
  • create-temporary-login/trunk/uninstall.php

    r3083509 r3095291  
    66}
    77
    8 //Getting only ctl users
     8// Get all users
    99$ctl_users = get_users();
    1010
    1111foreach ($ctl_users as $key => $user) {
     12    //Getting only ctl users
    1213    if( get_user_meta( $user->ID, 'ctl_user', true ) ){
    1314        wp_delete_user( sanitize_text_field( $user->ID ) );
Note: See TracChangeset for help on using the changeset viewer.