modifié : ../app.py nouveau fichier : cloud.py nouveau fichier : common_imports.py nouveau fichier : config.py nouveau fichier : dns.py nouveau fichier : kaz_user.py nouveau fichier : ldap.py nouveau fichier : mattermost.py nouveau fichier : paheko.py nouveau fichier : password.py nouveau fichier : quota.py nouveau fichier : sympa.py nouveau fichier : test.py
		
			
				
	
	
		
			35 lines
		
	
	
		
			880 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			880 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| from resources.common_imports import *
 | |
| 
 | |
| #les variables globales minimum
 | |
| #from resources.config import 
 | |
| 
 | |
| 
 | |
| class Password_create(Resource):
 | |
|     @jwt_required()
 | |
|     def get(self):
 | |
|         """
 | |
|         créer un password qui colle avec les appli kaz
 | |
|         ---
 | |
|         tags:
 | |
|           - Password
 | |
|         security:
 | |
|           - Bearer: []
 | |
|         parameters: []
 | |
|         responses:
 | |
|           200:
 | |
|             description: le password
 | |
|           404:
 | |
|             description: oops 
 | |
|         """    
 | |
|         global new_password
 | |
| 
 | |
|         cmd="apg -n 1 -m 10 -M NCL -d"
 | |
|         try:
 | |
|             output = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)        
 | |
|             new_password="_"+output.decode("utf-8")+"_"
 | |
|             return new_password,200          
 | |
|         
 | |
|         except subprocess.CalledProcessError as e:
 | |
|             return e.output.decode("utf-8"), 400 
 | |
|  
 |