mirror of
				https://github.com/mealie-recipes/mealie.git
				synced 2025-10-31 02:03:35 -04:00 
			
		
		
		
	* style(frontend): 💄 add darktheme custom * add dummy users in dev mode * feat(frontend): ✨ add group permissions editor UI * feat(backend): ✨ add group permissions setters * test(backend): ✅ tests for basic permission get/set (WIP) Needs more testing * remove old test * chore(backend): copy template.env on setup * feat(frontend): ✨ enable send invitation via email * feat(backend): ✨ enable send invitation via email * feat: ✨ add app config checker for site-settings * refactor(frontend): ♻️ consolidate bool checks Co-authored-by: Hayden <hay-kot@pm.me>
		
			
				
	
	
		
			62 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			62 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
| from mealie.core import root_logger
 | |
| from mealie.core.config import settings
 | |
| from mealie.core.security import hash_password
 | |
| from mealie.db.data_access_layer.access_model_factory import Database
 | |
| 
 | |
| logger = root_logger.get_logger("init_users")
 | |
| 
 | |
| 
 | |
| def dev_users() -> list[dict]:
 | |
|     return [
 | |
|         {
 | |
|             "full_name": "Jason",
 | |
|             "username": "jason",
 | |
|             "email": "jason@email.com",
 | |
|             "password": hash_password(settings.DEFAULT_PASSWORD),
 | |
|             "group": settings.DEFAULT_GROUP,
 | |
|             "admin": False,
 | |
|         },
 | |
|         {
 | |
|             "full_name": "Bob",
 | |
|             "username": "bob",
 | |
|             "email": "bob@email.com",
 | |
|             "password": hash_password(settings.DEFAULT_PASSWORD),
 | |
|             "group": settings.DEFAULT_GROUP,
 | |
|             "admin": False,
 | |
|         },
 | |
|         {
 | |
|             "full_name": "Sarah",
 | |
|             "username": "sarah",
 | |
|             "email": "sarah@email.com",
 | |
|             "password": hash_password(settings.DEFAULT_PASSWORD),
 | |
|             "group": settings.DEFAULT_GROUP,
 | |
|             "admin": False,
 | |
|         },
 | |
|         {
 | |
|             "full_name": "Sammy",
 | |
|             "username": "sammy",
 | |
|             "email": "sammy@email.com",
 | |
|             "password": hash_password(settings.DEFAULT_PASSWORD),
 | |
|             "group": settings.DEFAULT_GROUP,
 | |
|             "admin": False,
 | |
|         },
 | |
|     ]
 | |
| 
 | |
| 
 | |
| def default_user_init(db: Database):
 | |
|     default_user = {
 | |
|         "full_name": "Change Me",
 | |
|         "username": "admin",
 | |
|         "email": settings.DEFAULT_EMAIL,
 | |
|         "password": hash_password(settings.DEFAULT_PASSWORD),
 | |
|         "group": settings.DEFAULT_GROUP,
 | |
|         "admin": True,
 | |
|     }
 | |
| 
 | |
|     logger.info("Generating Default User")
 | |
|     db.users.create(default_user)
 | |
| 
 | |
|     if not settings.PRODUCTION:
 | |
|         for user in dev_users():
 | |
|             db.users.create(user)
 |