mirror of
https://github.com/KuekHaoYang/KVideo.git
synced 2026-08-22 12:13:43 +08:00
feat: add environment variable password protection and integrate it into the password gate component.
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
'use server';
|
||||
|
||||
/**
|
||||
* Verifies if the provided password matches the ACCESS_PASSWORD environment variable.
|
||||
*/
|
||||
export async function verifyEnvPassword(password: string): Promise<boolean> {
|
||||
const accessPassword = process.env.ACCESS_PASSWORD;
|
||||
if (!accessPassword) return false;
|
||||
return password === accessPassword;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a password is required by checking the presence of ACCESS_PASSWORD in the environment.
|
||||
*/
|
||||
export async function isEnvPasswordRequired(): Promise<boolean> {
|
||||
return !!process.env.ACCESS_PASSWORD;
|
||||
}
|
||||
Reference in New Issue
Block a user