Пример #1
0
def login_attempt():
    """
    Called through the login form. The call pulls out the email from the form as well as
    the password.

    A list of admins accounts that have the given user name are collected. If there is no
    admin in the list, then the user is redirected back to login.

    If the password does not match, the user is again redirected back to the login page
    """
    # Pull the email and password from the form
    user_name = request.form['email'].lower()
    password = request.form['password']

    # Get the all admins from the database that has the same user name
    admins = database.AdminAccount.objects.all()
    admins = list(
        filter(lambda admin: admin.user_name.lower() == user_name, admins))

    # Invalid username, no admins with the given username
    if len(admins) == 0:
        return redirect('/login')
    admin = admins[0]
    # Invalid password
    if database.verify_password(admin, password) is not True:
        return redirect('/login')
    # Valid username and password
    return redirect('/usermod')
Пример #2
0
def login():
    u = request.form['login']
    p = request.form['password']
    if db.verify_password(u, p):
        response = make_response(redirect('/'))
        response.set_cookie('username', u)
        return response
    else:
        time.sleep(3)
        return '''<p>incorrect password</p>
Пример #3
0
 def check_run_permission(self, sn, test_name):
     """ check the permission of a user to see if he is elgible for
     rerunning a test"""
     cf = self._config
     user = str(cf.user)
     ui = cf.userinterface
     tbl_username = '******'
     uut_id = cf.uut_id
     test_status = database.get_test_status(cf, uut_id, test_name)
     ui.info("%s last pass_fail status was '%s'" % (test_name, test_status))
     self.rpt.add_message("INFO", "%s last pass_fail status was '%s'" % (test_name, test_status))
     if (((test_status == 'F') and (not cf.part_no.startswith('8'))) or
             ((test_status == 'F') and cf._FORCE_CHECK_PERMISSION)):  # XXX should they be locked out if it's incomplete?
         ui.info("Checking run permission...")
         cf.retest_logging = True
         # previous run was a FAIL, now check if he's elgible to do rerun
         if cf.flags.USERGROUP != 'opsusers':
             ui.info("User '%s' has permission to rerun previous FAILed tests!" % user)
             self.rpt.add_message("INFO", "User '%s' has permission to rerun previous FAILed tests!" % user)
             return True
         else:
             # no permission, prompt for test engineer password.
             ui.error("You are trying to rerun a previous FAILed test, but you don't have permission, you need to enter the 'Test Engineering' password!")
             self.rpt.add_message("ERROR", "You are trying to rerun a previous FAILed test, but you don't have permission, you need to enter the 'Test Engineering' password!")
             pw = getpass.getpass()
             if not database.verify_password(tbl_username, pw, cf.DBURI):
                 ui.error("Password entered does not match database, you have one more try.")
                 pw = getpass.getpass()
                 if not database.verify_password(tbl_username, pw, cf.DBURI):
                     ui.error("Password entered mismatch on 2nd try, exiting...")
                     return False
                 else:
                     ui.info("Engineering password verified!")
                     self.rpt.add_message("INFO", "Engineering password verified!")
                     return True
             else:
                 ui.info("Engineering password verified!")
                 self.rpt.add_message("INFO", "Engineering password verified!")
                 return True
     else:
         cf.retest_logging = False
         return True
Пример #4
0
 def check_password(self):
     """ prompt and check the engineering password. 
     return True if password match, False otherwise
     """
     cf = self.config
     
     tbl_username = '******'
     self.diagnostic("You are trying to run BurnIn for less than 48 hrs, you need to enter the test engineering password to proceed...")
     pw = getpass.getpass()
     if not database.verify_password(tbl_username, pw, cf.DBURI):
         self.error("Password entered does not match database, you have one more try.")
         pw = getpass.getpass()
         if not database.verify_password(tbl_username, pw, cf.DBURI):
             self.error("Password entered mismatch on 2nd try, exiting...")
             return False
         else:
             self.info("Engineering password verified!")
             return True
     else:
         self.info("Engineering password verified!")
         return True
Пример #5
0
    def check_password(self):
        """ prompt and check the engineering password. 
        return True if password match, False otherwise
        """
        cf = self.config

        tbl_username = "******"
        self.diagnostic("PLEASE ENTER THE ENGR PASSWORD")
        pw = getpass.getpass()
        if not database.verify_password(tbl_username, pw, cf.DBURI):
            self.error("Password entered does not match database, you have one more try.")
            pw = getpass.getpass()
            if not database.verify_password(tbl_username, pw, cf.DBURI):
                self.error("Password entered mismatch on 2nd try, exiting...")
                return False
            else:
                self.info("Engineering password verified!")
                return True
        else:
            self.info("Engineering password verified!")
            return True
Пример #6
0
    def test_method(self):
        # now begin the actual testing
        tb = self.config.testbed
        self.MASTER_TAG_LIST = [
                #'DEMOD_MFG.xml',
                #'DEMUX_MFG.xml',
                #'DRIVER_AMP_ADJ_MFG.xml',
                #'DRIVER_AMP_MFG.xml',
                #'EDFA_MFG.xml',
                #'LASER_MFG.xml',
                'LINE_INTF_MFG.xml',
                #'MOD_MFG.xml',
                #'MUX_MFG.xml',
                #'PHRX_MFG.xml',
                #'TDC_CIR_MFG.xml',
                #'TDC_MFG.xml',
                #  Calibration tags
                #'DMUX_CAL.xml',
                #'DRIVER_AMP_ADJ_CAL.xml',
                #'DRIVER_AMP_CAL.xml',
                #'EDFA_CAL.xml',
                #'MOD_TAP_CAL.xml',
                #'MUX_CAL.xml',
                #'PHRX_CAL.xml',
                #'TDC_CAL.xml',
		]
        # prompt for password.
        self.info("This is a restricted program.  Please enter test engr password: "******"Password entered does not match database, you have one more try.")
            pw = getpass.getpass()
            if not database.verify_password(tbl_username, pw, cf.DBURI):
                return self.abort("Password entered mismatch on 2nd try, exiting...")
            else:
                self.info("Engineering password verified!")
        
        else:
            self.info("Engineering password verified!")
        
        signal.signal(signal.SIGCHLD, signal.SIG_IGN)
        sn = cf.ser_no
        ber_obj = self.UUT
        self.info("### Running UUT (%s)" % (sn))
        sn_id = cf.uut_id
        # now get all MFG tags associated with the top SN.  
        res_path = database.get_result_path(self.config, sn_id, 'Titan_saveTags')
        if res_path is None:
            self.errorCount = 1
            self.abort("Can't find xml directory!")
        dir_str = commands.getoutput('ls %s/*.xml' % res_path)
        file_list = dir_str.split('\n')
        self.info("Setting module to flash mode...")
        ber_obj.flashModeSelect()
        self.info("TAGS PATH: %s" %  res_path)
        # 1: restore PhCal tag by looking for PHRX_CAL tag 
        for fname in file_list:
            tag_file = os.path.basename(fname)
            if tag_file: # in self.MASTER_TAG_LIST:  #XXX: use this for dbg
                tag_name = tag_file[:-4]
                if tag_file == 'PHRX_CAL.xml':
                    phrx_cal_path = database.get_result_path(self.config, sn_id, 'PhCalVadj')
                    if phrx_cal_path:
                        self.info("PhCalVadj has run....")
                        phrx_cal_file = commands.getoutput('ls %s/*.xml' % phrx_cal_path)
                        f_obj = file(phrx_cal_file)
                    else:
                        self.info("PhCalVadj has not run yet, using result from saveTag test...")
                        f_obj = file(fname)
                    xml_str = f_obj.read()
                    pom_obj = ber_obj.stringToPomObj(xml_str, tag_name)

                    ber_obj.download(pom_obj)
                    self.save_file(fname)
                else:
                    try:
                        f_obj = file(fname)
                        self.info("Restoring tag from '%s'..." % tag_file)
                        xml_str = f_obj.read()
                        pom_obj = ber_obj.stringToPomObj(xml_str, tag_name)
                        ber_obj.download(pom_obj)
                        self.save_file(fname)
                        time.sleep(20)
                    except:
                        self.errorCount = 1
                        return self.failed("Can't find XML information!")
        # add some sleeps prior to the final reset
        time.sleep(30)

        # DO THIS FROM CAROL
        ber_obj.reset_card_from_mfgtest()
                    
        reset_dsp_sleep_time = 100
        self.info("Wait %s seconds for DSP to come up..." % reset_dsp_sleep_time)
        time.sleep(reset_dsp_sleep_time)

        self.diagnostic(self.errorCount)
        if self.errorCount:
            self.lf.write("\n\nERROR: %s(%s):\n UUT RestoreMfgTags_MfgSw test failed.\n" 
                            %(slot, sn))
            self.failed("UUT RestoreMfgTags_MfgSw test failed.\n")
        else:
            self.passed("UUT RestoreMfgTags_MfgSw test passed.\n")
          
        return self.completed("RestoreMfgTags_MfgSw test completed.")
Пример #7
0
    def test_method(self):
        self.errorCount = {} 
        # now begin the actual testing
        tb = self.config.testbed
        self.MASTER_TAG_LIST = [
                #'LINE_INTF_MFG.xml',
                'DEMOD_MFG.xml',
                #'DEMUX_MFG',
                #'DRIVER_AMP_MFG',
                #'EDFA_MFG',
                #'LASER_MFG',
                #'MOD_MFG',
                #'MUX_MFG',
                #'PHRX_MFG',
                #'TDC_MFG',
                #'TDC_CIR_MFG',
                #'DRIVER_AMP_CAL',	
                #'DMUX_CAL',
                #'MUX_CAL',
		]
        # prompt for password.
        self.info("This is a restricted program.  Please enter test engr password: "******"Password entered does not match database, you have one more try.")
            pw = getpass.getpass()
            if not database.verify_password(tbl_username, pw, cf.DBURI):
                return self.abort("Password entered mismatch on 2nd try, exiting...")
            else:
                self.info("Engineering password verified!")
        
        else:
            self.info("Engineering password verified!")
        
        signal.signal(signal.SIGCHLD, signal.SIG_IGN)

        for sn in self.uutSnList:        #excluding refsn
            self.errorCount[sn] = 0
            slot = self.uutDict[sn]["slot"]
            UUT_ber = "UUT_slot%s" % slot
            ber_obj = self.uut_ser_dict[UUT_ber]
            sn_id = self.uutDict[sn]["id"]

            ser_obj = self.uut_ser_dict[slot]
            obj = ser_obj
            self.info("### Running UUT (%s) on slot (%s)" % (sn, slot))
            # now get all MFG tags associated with the top SN.  
            res_path = database.get_result_path(self.config, sn_id, 'Titan_saveTags')
            if res_path is None:
                self.errorCount[sn] = 1
                self.abort("Can't find xml directory!")
            dir_str = commands.getoutput('ls %s/*.xml' % res_path)
            file_list = dir_str.split('\n')
            self.info("Setting module to flash mode...")
            ber_obj.prepFlash()
            self.info("TAGS PATH: %s" %  res_path)
            # 1: restore PhCal tag by looking for PHRX_CAL tag 
            self.info("Disabling Driver and Balance Loops...")
            obj.disable_drv_bal_loops()
            for fname in file_list:
                tag_file = os.path.basename(fname)
                if tag_file in self.MASTER_TAG_LIST:
                    try:
                        f_obj = file(fname)
                        self.info("Restoring tag from '%s'..." % tag_file)
                        ber_obj.download_xml_cust(f_obj)
                        self.save_file(fname)
                    except:
                        self.errorCount[sn] = 1
                        return self.failed("Can't find XML information!")


        # DO THIS FROM CAROL
        #ber_obj.reset_card()
                    
        #reset_dsp_sleep_time = 100
        #self.info("Wait %s seconds for DSP to come up..." % reset_dsp_sleep_time)
        #time.sleep(reset_dsp_sleep_time)

        for sn in self.uutSnList:
            slot = self.uutDict[sn]["slot"]
            uutid = self.uutDict[sn]["id"]
            self.diagnostic(self.errorCount[sn])
            if self.errorCount[sn]:
                self.lf.write("\n\nERROR: %s(%s):\n UUT RestoreMfgTags test failed.\n" 
                            %(slot, sn))
                self.failed("%s(%s):\n UUT RestoreMfgTags test failed.\n" %(slot, sn), uutid)
            else:
                self.passed("%s(%s):\n UUT RestoreMfgTags test passed.\n" %(slot, sn), uutid)
          
        return self.completed("RestoreMfgTags test completed.")