2fa-0.8
This commit is contained in:
		
							parent
							
								
									078af33e77
								
							
						
					
					
						commit
						7a7edc1f92
					
				
							
								
								
									
										3
									
								
								app.py
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								app.py
									
									
									
									
									
								
							@ -58,6 +58,7 @@ def get_index():
 | 
			
		||||
    try:
 | 
			
		||||
        print(newSession().get())
 | 
			
		||||
        print(newSession().secure_logged_in)
 | 
			
		||||
        print(newSession().id);
 | 
			
		||||
        while(newSession().get()['secureAuth'] and not newSession().secure_logged_in):
 | 
			
		||||
            logout(newSession().get()['username'])
 | 
			
		||||
 
 | 
			
		||||
@ -1188,7 +1189,7 @@ def newSession():
 | 
			
		||||
        def __init__(self):
 | 
			
		||||
            super(Session, self).__init__()
 | 
			
		||||
            self.data = bottle.request.environ.get('beaker.session')
 | 
			
		||||
            #self.logged_in = False
 | 
			
		||||
            self.id = tools.session_id()
 | 
			
		||||
            self.secure_logged_in = False
 | 
			
		||||
            self.lang = self.get_lang()
 | 
			
		||||
            #localization
 | 
			
		||||
 | 
			
		||||
@ -6,6 +6,7 @@ from onetimepass import valid_totp
 | 
			
		||||
from secrets import choice
 | 
			
		||||
import segno
 | 
			
		||||
from os import path
 | 
			
		||||
import uuid
 | 
			
		||||
 | 
			
		||||
class Tools():
 | 
			
		||||
    
 | 
			
		||||
@ -69,4 +70,7 @@ class Tools():
 | 
			
		||||
            print('Wrong otp, please try again.')
 | 
			
		||||
            return False
 | 
			
		||||
 | 
			
		||||
    def session_id(self):
 | 
			
		||||
        return uuid.uuid4().hex
 | 
			
		||||
 | 
			
		||||
tools = Tools()
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user