2fa-0.9
This commit is contained in:
		
							parent
							
								
									f2ffabad3e
								
							
						
					
					
						commit
						4fe1bec588
					
				
							
								
								
									
										8
									
								
								app.py
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								app.py
									
									
									
									
									
								
							| @ -54,7 +54,6 @@ def get_index(): | ||||
| 
 | ||||
| @get('/user') | ||||
| def get_index(): | ||||
|     print('SESSION:',newSession().get()) | ||||
|     try: | ||||
|         print('SESSION:',newSession().get()) | ||||
|         return user_tpl(data=newSession().get(), str=i18n.str) | ||||
| @ -162,8 +161,11 @@ def post_user(): | ||||
|         LOG.warning("Unsuccessful attempt to login %s: %s" % (form('username'), e)) | ||||
|         return error(str(e)) | ||||
|      | ||||
|     #data=[form('username'),form('password'),newSession().get()['id'],newSession().get()['authCode']] | ||||
|      | ||||
|     #print('N:',newSession().get()['id']) | ||||
|     key = cryptocode.encrypt(form('password'), newSession().get()['id']) | ||||
|     #key = cryptocode.encrypt(data, newSession().get()['id']) | ||||
|     print(key) | ||||
|     key = base64.urlsafe_b64encode(str.encode(key)) | ||||
|     print(key) | ||||
| @ -171,7 +173,7 @@ def post_user(): | ||||
|     try: | ||||
|         if(check_2fa_step1(form('username'))): | ||||
|             print('kk') | ||||
|             logout(form('username')) | ||||
|             #logout(form('username')) | ||||
|             return index_tpl(two_factor_authentication=True, key=key, str=i18n.str) | ||||
|     except Error as e: | ||||
|         LOG.warning("Erabiltzailea ez da aurkitu???") | ||||
| @ -216,7 +218,7 @@ def post_user_step2(key): | ||||
|     print("sid:",newSession().get()['id']) | ||||
|     print('pwd:',password) | ||||
| 
 | ||||
|     #logout(newSession().get()['username']) | ||||
|     logout(newSession().get()['username']) | ||||
|      | ||||
|     def error(msg): | ||||
|         return index_tpl(alerts=[('error', msg, 'fadeOut')], str=i18n.str) | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user