mirror of
				https://git.sr.ht/~tsileo/microblog.pub
				synced 2025-06-05 21:59:23 +02:00 
			
		
		
		
	Add task to reset password
This commit is contained in:
		
							
								
								
									
										15
									
								
								tasks.py
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								tasks.py
									
									
									
									
									
								
							| @@ -312,3 +312,18 @@ def yunohost_config( | |||||||
|         summary=summary, |         summary=summary, | ||||||
|         password=password, |         password=password, | ||||||
|     ) |     ) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | @task | ||||||
|  | def reset_password(ctx): | ||||||
|  |     # type: (Context) -> None | ||||||
|  |     import bcrypt | ||||||
|  |     from prompt_toolkit import prompt | ||||||
|  |  | ||||||
|  |     new_password = bcrypt.hashpw( | ||||||
|  |         prompt("New admin password: ", is_password=True).encode(), bcrypt.gensalt() | ||||||
|  |     ).decode() | ||||||
|  |  | ||||||
|  |     print() | ||||||
|  |     print("Update data/profile.toml with:") | ||||||
|  |     print(f'admin_password = "{new_password}"') | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user