예제 #1
0
    def start(self):
        print("Application started")

        lv = LoginView()
        lv.main()

        bv = BarView()
        bv.username = lv.username
        bv.main()
예제 #2
0
    def get(self, query_string: Dict[str, str], headers: Dict[str, str],
            multi_value_headers: Dict[str, List[str]]) -> dict:
        try:
            failure_reason: FailureReason = FailureReason(
                query_string["failureReason"])
        except KeyError:
            failure_reason = None
        except ValueError:
            failure_reason = None

        session_secret: str = self.build_session_secret(headers["User-Agent"])
        csrf_token: str = self._csrf_token_generator.build_csrf_token(
            session_secret)
        return {
            "statusCode": 200,
            "body": LoginView.get_html(csrf_token,
                                       failure_reason=failure_reason),
            "headers": {
                "Set-Cookie":
                self.build_session_cookie(
                    self._jwt_generator.build_jwt(subject=session_secret),
                    self._COOKIE_DURATION),
                "Content-Type":
                "text/html"
            }
        }
예제 #3
0
class LoginController(object):
    '''
    This is controller for login screen
    '''
    
    def __init__(self, controller):
        self.controller = controller
        
    def run(self):
        print("loading login controller")
        self.view = LoginView()
        
        self.view.setButtonCallback(self.signIn)
        self.view.run()
            
    def signIn(self):
        print("sign in")
        
        passwordHash = hashlib.md5(self.view.getPassword())
        account = self.view.getLogin() + ":" + passwordHash.hexdigest()
        
        print(account)
        print(self.getAccounts())
        
        if account in self.getAccounts():
            print("Logged in")
            self.view.showError("Welcome")
        else:
            self.view.showError("Login or password is incorrect")
            
    def getAccounts(self):
        accounts = open("../data/account.db", "r", ).readlines()
        
        for i in range(len(accounts)):
            accounts[i] = accounts[i].strip('\n\xef\xbb\xbf')
            
        return accounts
        
예제 #4
0
    def main(self):
        window = Tk()

        window.title('Hello App')
        window.geometry('300x300')

        l = Label(window,text="hello")
        l.pack()

        lobj = LoginView()

        b = Button(window,text="login",command=lobj.main)
        b.pack()

        robj = RegisterView()
        b2 = Button(window, text="register", command =robj.main)
        b2.pack()

        window.mainloop()
예제 #5
0
__author__ = "Emmanuel Ariza, Orlando Saavedra"
__status__ = "Prototype"

from views.LoggedView import LoggedView
from django.conf.urls import url
import views
from django.contrib.auth.views import logout, password_reset_done, password_reset_confirm, password_reset_complete
from views.LoginView import LoginView
from views.DeactivateUserView import DeactivateUserView
from views.ProfileManagerView import ProfileManagerView
from views.RecoverAccountView import RecoverAccountView
from views.PasswordReset import DanePasswordReset
from views.views import isUsernameRegistered

urlpatterns = [
    url(r'^login', LoginView.as_view(), name='login'),
    url(r'^logged$', LoggedView.as_view(), name='logged'),
    url(r'^logout$', 
        logout, {"template_name": "DaneUsers/logout.html"}, 
        name = 'logout'),
               
    # Recover password section
    url(r'^user/password/reset/$', 
        DanePasswordReset.as_view(),
        {'template_name': 'DaneUsers/password_reset_form.html',
        'post_reset_redirect' : "DaneUsers:password_reset_done",
        'email_template_name': 'DaneUsers/password_reset_email.html'},
        name='recoverPassword'),
    url(r'^user/password/reset/done/$', 
        password_reset_done, 
        {'template_name': 'DaneUsers/password_reset_done.html'},
예제 #6
0
 def run(self):
     print("loading login controller")
     self.view = LoginView()
     
     self.view.setButtonCallback(self.signIn)
     self.view.run()
예제 #7
0
 def start(self):
     l = LoginView()
     l.main()