Exemple #1
0
def reload_account():
    global active_account
    if not active_account:
        return

    active_account, msg = svc.find_account_by_email(active_account.email,
                                                    active_account.password)
Exemple #2
0
def create_account():
    if state.active_account:
        error_msg("You are already logged in. Use this account.")
        return
    print(' ****************** REGISTER **************** ')
    name = input('What is your name? ')
    email = input('What is your email? ').strip().lower()
    password = input('Enter the passphrase : ')
    confirm_password = input('Retype the passphrase : ')
    if (name.strip(' ') == '' or email.strip(' ') == ''
            or password.strip(' ') == ''):
        error_msg(f"ERROR: All fields are required.")
        return

    if (password != confirm_password):
        error_msg(f"ERROR: Passphrases didn't match.")
        return

    old_account, msg = svc.find_account_by_email(email, password)
    """ above line has error. As msg variable is not used down below."""
    if old_account:
        error_msg(f"ERROR: Account with email {email} already exists.")
        return

    state.active_account = svc.create_account(name, email, password)
    success_msg(f"Created new account with id {state.active_account.id}.")
Exemple #3
0
def reload_account():
    global active_account
    if not active_account:
        return

    active_account, msg = svc.find_account_by_email(active_account.email,
                                                    active_account.password)
    """Where did we use msg which can have value 0,1 and 2?"""
Exemple #4
0
def log_into_account():
    print(' ****************** LOGIN **************** ')

    email = input('E-mail? :')
    owner = svc.find_account_by_email(email)
    if not owner:
        error_msg(f'No account exists by e-mail address :{email}')
        return
    success_msg('Logged In')
    state.active_account = owner
Exemple #5
0
def create_account():
    print(' ****************** REGISTER **************** ')
    name = input('Your Name? :')
    email = input('Your e-mail? :')
    old_account = svc.find_account_by_email(email)
    if old_account:
        error_msg(f"ERROR: Account with this email {email} already exists.")
        return
    state.active_account = svc.create_account(name, email)
    success_msg(f"Account created with account id {state.active_account.id}")
def log_into_account():
    print(" ****************** LOGIN **************** ")
    email = input("What is your email? ").strip().lower()
    account = svc.find_account_by_email(email)
    if not account:
        error_msg(f"Could not find account with email {email}.")
        return

    state.active_account = account
    success_msg("Logged in successfully.")
Exemple #7
0
def log_into_account():
    print(' ****************** LOGIN **************** ')

    email = input("Qual o seu email? ").strip().lower()
    account = svc.find_account_by_email(email)

    if not account:
        error_msg(f"Nao foi possivel encontrar suas conta com o email: {email}")

    state.active_account = account
    success_msg("Login com sucesso")
def login():
  if state.active_account:
    error_msg("You are already logged in")
    return
  print('\n       ********** Login **********   \n')
  email = input('Please Enter Your Email.... ')
  user = services.find_account_by_email(email)
  if not user:
    error_msg('This email is not registered yet, please create an account')
    return
  state.active_account = user
  success_msg(f'Welcome {user.name.upper()}') 
def create_account():
  if state.active_account:
    error_msg("You already have an account")
    return
  print('\n       ********** Register **********    \n')
  name = input('Enter your name....')
  email = input('Enter your email....').strip().lower()
  if services.find_account_by_email(email):
    error_msg('!! This email is already in use !!')
    return
  state.active_account = services.create_account(name, email)
  success_msg(f'Successfully Created Account For {name} with ID >> {state.active_account.id}')
def create_account():
    print(" ****************** REGISTER **************** ")
    name = input("What is your name? ")
    email = input("What is your email? ").strip().lower()

    old_account = svc.find_account_by_email(email)
    if old_account:
        error_msg(f"ERROR: Account with email {email} already exists.")
        return

    state.active_account = svc.create_account(name, email)
    success_msg(f"Created new account with id {state.active_account.id}"  # pylint: disable=no-member
                )
Exemple #11
0
def create_account():
    print(' ****************** REGISTER **************** ')
    name = input('Qual o seu nome? ')
    email = input('Seu email? ').strip().lower()

    old_account = svc.find_account_by_email(email)

    if old_account:
        error_msg(f"ERRO: A conta com o email {email} já existe.")
        return

    state.active_account = svc.create_account(name, email)
    success_msg(f"Nova conta com o id {state.active_account.id} criada com sucesso!")
Exemple #12
0
def log_into_account():
    print(' ****************** LOGIN **************** ')

    email = input('What is your email? ').strip().lower()
    password = input('Enter the passphrase : ')
    account,msg = svc.find_account_by_email(email,password)

    if (msg==1):
        error_msg(f'Could not find account with email {email}.')
        return
    elif (msg==2):
        error_msg(f"Email and Passphrase didn't match.")
        return

    state.active_account = account
    success_msg('Logged in successfully.')
Exemple #13
0
def create_account():
    print(' ****************** REGISTER **************** ')
    name = input('What is your name? ')
    email = input('What is your email? ').strip().lower()
    password = input('Enter the passphrase : ')
    confirm_password = input('Retype the passphrase : ')
    if (name.strip(' ')=='' or email.strip(' ')=='' or password.strip(' ')==''):
        error_msg(f"ERROR: All fields are required")
        return
    
    if (password!=confirm_password):
        error_msg(f"ERROR: Passphrases didn't match.")
        return
    
    old_account,msg = svc.find_account_by_email(email,password)
    if old_account:
        error_msg(f"ERROR: Account with email {email} already exists.")
        return
        
    state.active_account = svc.create_account(name, email, password)
    success_msg(f"Created new account with id {state.active_account.id}.")
def reload_account():
    global active_account
    if active_account:
        active_account = services.find_account_by_email(active_account.email)
def reload_account():
    global active_account
    if not active_account:
        return

    active_account = svc.find_account_by_email(active_account.email)