Greasy Fork is available in English.

Website Password Lock

Lock a website with a password

Autor
TigerTech
Instalações hoje
0
Total de instalações
17
Avaliações
0 0 0
Versão
1.0
Criado
18/07/2024
Atualizado
18/07/2024
Licença
N/A
Aplicável a
Todos os sites

Website Password Lock
Description:
The Website Password Lock userscript allows you to lock any website with a simple password prompt. This script can be especially useful for adding an extra layer of security to your browsing experience, ensuring that only authorized users can access certain websites.

Features:
Password Protection: Locks any website with a customizable password prompt.
Easy to Use: Simple setup and configuration through the userscript manager.
Universal Compatibility: Works on all HTTP and HTTPS websites.
How to Use:
Install a Userscript Manager:

For Chrome, install Tampermonkey.
For Firefox, install Greasemonkey.
Install the Script:

Visit the Website Password Lock script page.
Click on the "Install this script" button.
Set the Password:

By default, the password is set to Tigertech. You can change this password in the script for enhanced security.
Open your userscript manager dashboard.
Locate the "Website Password Lock" script and click "Edit".
Modify the line const correctPassword = 'Tigertech'; to your desired password.
Save the changes.
Accessing Locked Websites:

Upon visiting any website, you will be prompted to enter the password.
Enter the correct password to gain access.
If the incorrect password is entered, an "Access Denied" message will be displayed.
Example:
Prompt for Password:


Access Granted:


Access Denied:


Security Note:
This script provides basic password protection, suitable for casual use. However, it should not be relied upon for securing sensitive or confidential information, as client-side scripts can be bypassed by knowledgeable users. For more robust security, consider server-side authentication solutions.

Update URL:
Ensure you keep the script updated to benefit from any improvements or bug fixes. The update URL will be provided soon.

Support and Feedback:
For any issues, suggestions, or feedback, please visit the support page or contact the author directly.

Tutorial: Customizing the Website Password Lock Userscript for Specific Sites
This tutorial will guide you through the process of modifying the Website Password Lock userscript to function only on specific websites. By customizing the script, you can ensure it prompts for a password only on the sites you specify.

Prerequisites:
A userscript manager like Tampermonkey or Greasemonkey.
Basic knowledge of JavaScript (optional but helpful).
Steps:
Install a Userscript Manager:

For Chrome, install Tampermonkey.
For Firefox, install Greasemonkey.
Create or Edit the Userscript:

Open the Tampermonkey or Greasemonkey dashboard.
Create a new script or edit the existing Website Password Lock script.
Modify the Metadata Block:
The @include and @match directives in the metadata block determine which websites the script will run on. You can specify the URLs of the sites you want to protect with a password.

Example for Specific Sites:

javascript
Copy code
// ==UserScript==
// @name Website Password Lock
// @version 1.0
// @description Lock specific websites with a password
// @author Tigertech
// @include https://example.com/*
// @include https://another-example.com/*
// @grant none
// ==/UserScript==
Replace https://example.com/* and https://another-example.com/* with the URLs of the sites you want to lock. The * wildcard character allows the script to run on any page within that domain.

Script Functionality:
Here's the complete script, customized to run only on specified sites:

javascript
Copy code
// ==UserScript==
// @name Website Password Lock
// @version 1.0
// @description Lock specific websites with a password
// @author Tigertech
// @include https://example.com/*
// @include https://another-example.com/*
// @grant none
// ==/UserScript==

(function() {
'use strict';

// Define the password
const correctPassword = 'Tigertech';

// Prompt the user for the password
let userPassword = prompt('Enter the password to access this site:');

// Check if the entered password is correct
if (userPassword !== correctPassword) {
document.body.innerHTML = '

Access Denied. Check the userscripts home page to learn more.

';
} else {
alert('Access Granted!');
}
})();
Save and Test the Script:

Save the script in your userscript manager.
Visit the specified websites (e.g., https://example.com and https://another-example.com).
You should be prompted to enter the password when accessing these sites.
Add More Sites:
To add more sites, simply include additional @include or @match lines in the metadata block. For example:


// @include https://yetanother-example.com/*
Notes:
The @include directive is straightforward for specifying URLs, but it can sometimes be less precise. The @match directive provides more precision and flexibility.
Example using @match:
// @match *://*.example.com/*
// @match *://another-example.com/*
By following these steps, you can customize the Website Password Lock userscript to run only on specific sites of your choice. This way, you can have control over which websites require a password for access, enhancing your browsing security selectively.






Plz give feedback.Thank you!