mirror of
				https://github.com/mealie-recipes/mealie.git
				synced 2025-11-03 10:43:40 -05:00 
			
		
		
		
	* fix disable button * add backend env for restricting registration * update state management * add allow_signup to app info * move allow_signup to backend only * cleanup docker-compose * potential darkmode fix * fix missing variable * add banner on login page * use random bools for tests * fix initial state bug * fix state reset
		
			
				
	
	
		
			29 lines
		
	
	
		
			843 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			843 B
		
	
	
	
		
			Python
		
	
	
	
	
	
import random
 | 
						|
import string
 | 
						|
 | 
						|
from mealie.schema.user.registration import CreateUserRegistration
 | 
						|
 | 
						|
 | 
						|
def random_string(length=10) -> str:
 | 
						|
    return "".join(random.choice(string.ascii_lowercase + string.digits) for _ in range(length)).strip()
 | 
						|
 | 
						|
 | 
						|
def random_email(length=10) -> str:
 | 
						|
    return "".join(random.choice(string.ascii_lowercase + string.digits) for _ in range(length)) + "@fake.com"
 | 
						|
 | 
						|
 | 
						|
def random_bool() -> bool:
 | 
						|
    return bool(random.getrandbits(1))
 | 
						|
 | 
						|
 | 
						|
def user_registration_factory(advanced=None, private=None) -> CreateUserRegistration:
 | 
						|
    return CreateUserRegistration(
 | 
						|
        group=random_string(),
 | 
						|
        email=random_email(),
 | 
						|
        username=random_string(),
 | 
						|
        password="fake-password",
 | 
						|
        password_confirm="fake-password",
 | 
						|
        advanced=advanced or random_bool(),
 | 
						|
        private=private or random_bool(),
 | 
						|
    )
 |