Coding standards
Security in ResourceSpace
Developer reference
Database
Action functions
Admin functions
Ajax functions
Annotation functions
API functions
Collections functions
Comment functions
Config functions
CSV export functions
Dash functions
Debug functions
Encryption functions
Facial recognition functions
File functions
General functions
Language functions
Log functions
Login functions
Message functions
Migration functions
Node functions
PDF functions
Plugin functions
Render functions
Reporting functions
Request functions
Research functions
Slideshow functions
Theme permission functions
User functions
Video functions
Database functions
Metadata functions
Resource functions
Search functions
Map functions
Job functions
Tab functions
Test functions

render_share_password_question()

Description

Renders a question field for setting a share password.

This function generates an HTML input field where users can set or change
the password for shared access to a resource. It includes functionality to
toggle password visibility and indicates if the password is required.

Parameters

ColumnTypeDefaultDescription
$blank bool true Indicates if the password field should be left blank (default is true).

Location

include/render_functions.php lines 5690 to 5740

Definition

 
function render_share_password_question($blank=true)
    {
    global 
$lang$share_password_required
    
?>
    <div class="Question">
    <label for="sharepassword"> echo strip_tags_and_attributes($lang["share-set-password"]); echo $share_password_required '<sup>*</sup>' ''?></label>
    <input type="password"  echo $share_password_required 'required' ''?> id="sharepassword" name="sharepassword" autocomplete="new-password" maxlength="40" class="stdwidth" value=" echo $blank "" escape($lang["password_unchanged"]); ?>">
    <span class="fa fa-fw fa-eye-slash infield-icon" id="share-password-icon" onclick="togglePassword('sharepassword');"></span>
    <script>

    function togglePassword(pwdelement)
        {
        input = jQuery('#' + pwdelement);
        if (input.attr("type") == "password")
            {
            input.attr("type", "text");
            jQuery('#share-password-icon').removeClass('fa-eye-slash').addClass('fa-eye');
            }
        else
            {
            input.attr("type", "password");
            jQuery('#share-password-icon').removeClass('fa-eye').addClass('fa-eye-slash');
            }
        }
    var passInput="";
    var passState="(unchanged)";
    var passHistory="";
    function pclick(id) 
        {
        // Set to password mode
        document.getElementById(id).type="password";
        document.getElementById(id).value=passState;
        document.getElementById(id).select();
        }
    function pblur(id) 
        {
        // Copy keyed input other than bracketed placeholders to hidden password
        passInput = document.getElementById(id).value;
        if(passInput!="(unchanged)" && passInput!="(changed)") 
            {
            document.getElementById("sharepassword").value=passInput; 
            passState="(changed)";
            }
        // Return to text mode showing the appropriate bracketed placeholder
        document.getElementById(id).value=passState;
        document.getElementById(id).type="text";
        }
    </script>
    </div>
    
    
}

This article was last updated 4th December 2024 08:35 Europe/London time based on the source file dated 3rd December 2024 11:55 Europe/London time.