Fix brand theme application and add comprehensive translations
- Fixed theme not being reflected on gallery and admin login pages - Created GlobalThemeProvider to apply themes globally - Updated gallery and admin login pages to use dynamic CSS variables - Added complete translations for all admin sections in English and German: - Notifications management - Event view and creation - Photo upload functionality - Category management - Archive page view - Analytics dashboard - Branding and theme settings - System settings - CMS page management - Email configuration - Fixed admin photo management display issues - Fixed photo upload category assignment - Added password reset functionality for galleries - Improved error handling and user feedback 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* Generate a secure random password
|
||||
* @param {number} length - Password length (default 12)
|
||||
* @returns {string} Generated password
|
||||
*/
|
||||
function generatePassword(length = 12) {
|
||||
const lowercase = 'abcdefghijklmnopqrstuvwxyz';
|
||||
const uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
const numbers = '0123456789';
|
||||
const symbols = '!@#$%&*';
|
||||
|
||||
// Ensure at least one character from each set
|
||||
const requiredChars = [
|
||||
lowercase[Math.floor(Math.random() * lowercase.length)],
|
||||
uppercase[Math.floor(Math.random() * uppercase.length)],
|
||||
numbers[Math.floor(Math.random() * numbers.length)],
|
||||
symbols[Math.floor(Math.random() * symbols.length)]
|
||||
];
|
||||
|
||||
// Fill the rest with random characters from all sets
|
||||
const allChars = lowercase + uppercase + numbers + symbols;
|
||||
const remainingLength = length - requiredChars.length;
|
||||
|
||||
let password = '';
|
||||
for (let i = 0; i < remainingLength; i++) {
|
||||
password += allChars[Math.floor(Math.random() * allChars.length)];
|
||||
}
|
||||
|
||||
// Combine and shuffle
|
||||
const passwordArray = [...requiredChars, ...password];
|
||||
for (let i = passwordArray.length - 1; i > 0; i--) {
|
||||
const j = Math.floor(Math.random() * (i + 1));
|
||||
[passwordArray[i], passwordArray[j]] = [passwordArray[j], passwordArray[i]];
|
||||
}
|
||||
|
||||
return passwordArray.join('');
|
||||
}
|
||||
|
||||
module.exports = { generatePassword };
|
||||
Reference in New Issue
Block a user