当前位置: 首页>>代码示例>>Python>>正文


Python login.Login类代码示例

本文整理汇总了Python中login.Login的典型用法代码示例。如果您正苦于以下问题:Python Login类的具体用法?Python Login怎么用?Python Login使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Login类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Main

class Main(ShowBase):
	def __init__(self):
		ShowBase.__init__(self)
		self.login = Login(self)
	
	def startMainmenu(self):
		self.login.hide()
		self.mainmenu = MainMenu(self)
		self.pregame = Pregame(self)
		self.mainmenu.show()
	
	def startPregame(self):
		self.mainmenu.hide()
		self.pregame.reset()
		self.pregame.show()

	def returnToMenu(self):
		self.pregame.hide()
		self.mainmenu.show()
	
	def startRound(self):
		self.pregame.hide()
		self.round = Round(self)
	
	def endRound(self):
		self.round.destroy()
		del self.round
		self.pregame.show()
		
	def hostGame(self, params):
		pid = Popen(["python", "server.py", params]).pid
		print 'Server Process ID:', pid
	
	def quit(self):
		sys.exit()
开发者ID:H3LLB0Y,项目名称:Centipede,代码行数:35,代码来源:main.py

示例2: main

    def main(self):
        """
        :cls: Allows clean the console window
        :read_user: Allows ask the user and password
        :display menu: Allows to show different menus for different users:
        Administrator, Employee, Visitor and Customer
        """
        self.cls()

        #        login = Login()
        #        login.read_user()
        #        user_name = "Pedro"
        #        password = "Control123"
        #        role = "Visitor"
        login_init = Login()
        if login_init.init_session():
            if login_init.get_session_user_role() == "Administrator":
                self.cls()
                mainmenu = MenuAdministrator()
                mainmenu.display_menu()
            elif login_init.get_session_user_role() == "Employee":
                self.cls()
                mainmenu = MenuEmployee()
                mainmenu.display_menu()
            elif login_init.get_session_user_role() == "Visitor":
                self.cls()
                mainmenu = MenuVisitor()
                mainmenu.display_menu()
开发者ID:royyery,项目名称:SICARIOS,代码行数:28,代码来源:mainclass.py

示例3: get

    def get(self):
        logging.debug("WebController.get()")
        user = Login().getIrssiUser(self.request.params)
        
        tokensList = []
        count = 0

        if user is not None:
            tokens = C2dmToken.all()
            tokens.ancestor(user.key())
            tokensList = tokens.fetch(10)

            messages = Message.all()
            messages.ancestor(user.key())
            count = messages.count(1)

        template_values = {
             'user': user,
             'tokens': tokensList,
             'loggedin': user is not None,
             'login_url': users.create_login_url("#profile").replace("&", "&"),
             'logout_url': users.create_logout_url("").replace("&", "&"),
             'irssiworking': count != 0,
             'c2dmtokencount': len(tokensList),
        }

        logging.debug(template_values)
        logging.debug(tokensList)

        template = jinja_environment.get_template('html/index.html')
        self.response.out.write(template.render(template_values))
开发者ID:tuhoojabotti,项目名称:IrssiNotifier,代码行数:31,代码来源:main.py

示例4: open

 def open(self):
     home = Home(self.driver)
     home.open()
     home.click_login_btn()
     login = Login(self.driver)
     login.login_user()
     self.go_to_page(self._add_new_link_url)
开发者ID:jaroslawkaczmarek,项目名称:co_slychac_selenium_tests,代码行数:7,代码来源:add_new_link.py

示例5: validarUsuario

    def validarUsuario(self):
        """
            Valida al usuario ingresada
        :return:
        """
        log=Login(str(self.lineUsuario.text()), str(self.lineContrasenia.text()),
                  self.mdi().window().getSesionBD())
        if self.usuario_activo != log.id_usuario:

            if self.usuario_activo != None:
                ok = QtGui.QMessageBox.information(self,"Aviso",QtCore.QString.fromUtf8("El usuario es distinto al actual. ¿Seguro que desea salir?"),\
                                          QtGui.QMessageBox.Cancel | QtGui.QMessageBox.Ok)
            else:
                ok = QtGui.QMessageBox.Ok

            if ok == QtGui.QMessageBox.Ok:
                rol=log.loginValido()
                if (rol):
                    self.usuario_activo = log.id_usuario
                    self.mdi().hide()
                    self.habilitarPermisos(rol)
                    self.limpiarCampos()
                    self.cerrarVentanas()
                else:
                    QtGui.QMessageBox.critical(self, 'Error', QtCore.QString.fromUtf8('Usuario o Contraseña incorrecta.'), 'Aceptar')
        else:
            QtGui.QMessageBox.information(self,"Aviso","Este usuario ya se encuentra logueado")
开发者ID:leaLuque,项目名称:FarmaciaCrisol,代码行数:27,代码来源:lgIngresar.py

示例6: init_config

 def init_config(recipe_kind):
     if recipe_kind == 'zhihu':      # TODO: 再有一个需要登录的网站, 改掉硬编码
         login = Login(recipe_kind='zhihu')
     else:
         return
     # !!!!!发布的时候把Config.remember_account改成false!!!!!,第一次需要登录,之后用cookie即可
     # 登陆成功了,自动记录账户
     if Config.remember_account_set:
         Debug.logger.info(u'检测到有设置文件,直接使用之前的设置')
         # if raw_input():
         # login.start()
         # Config.picture_quality = guide.set_picture_quality()
         Config.picture_quality = 1
         # else:
         try:
             Http.set_cookie()   # sinablog, jianshu: DontNeed
         except TypeError:
             print u"没有找到登录成功的cookie记录, 请重新登录"
             login.start()
     else:
         log.warning_log(u"Please login...")
         login.start()
         # Config.picture_quality = guide.set_picture_quality()
         Config.picture_quality = 1
         Config.remember_account_set = True
     # save config
     Config._save()
     return
开发者ID:gitter-badger,项目名称:EE-Book,代码行数:28,代码来源:main.py

示例7: handle_request

 def handle_request(self, request):
     args = {}
     for k, v in request.args.items():
         args.update({k: v[0]},)
     
     if len(request.postpath[0]) and not args.get('callback'):
         request.setResponseCode(400)
         return HTML
     
     if 'register' in request.postpath:
         register = Register(request, args)
         return register.response()
     
     if 'login' in request.postpath:
         login = Login(request, args)
         return login.response()
     
     if 'poll' in request.postpath:
         poll = Poll(request, args)
         return poll.response()
     
     if 'message' in request.postpath:
         message = Message(request, args)
         return message.response()
     
     if 'join' in request.postpath:
         join = Join(request, args)
         return join.response()
     
     else:
         return """
开发者ID:fuzzpedal,项目名称:chatapp,代码行数:31,代码来源:tap.py

示例8: Client

class Client(QtGui.QWidget):
    def __init__(self, app):
        super(Client, self).__init__()
        self.app = app
        
        self._load_securedrop_list()
        
        # open SecureDropList window
        self.choose_org = ChooseOrg(self.securedrop_list)
        self.choose_org.show()
        
        # launch login window
        self.choose_org.org_button_clicked.connect(self.launch_login)
        self.choose_org.other_button_clicked.connect(self.other_org)
    
    def launch_login(self, instance):
        self.login = Login(instance)
        self.login.back_button_clicked.connect(self.login_to_choose_org)
        self.choose_org.hide()
    
    def login_to_choose_org(self):
        self.login.close()
        self.choose_org.show()
    
    def other_org(self):
        common.alert('This has not been implemented yet. For now, choose one of the SecureDrop instances from the official list.')
    
    def _load_securedrop_list(self):
        # TODO: download securedrop_list.txt and securedrop_list.txt.asc from https://freedom.press/
        #       over Tor (or better yet, a hidden service) for updated list of instances
        
        # make a temporary gpg homedir and import securedrop pubkey
        homedir = tempfile.mkdtemp()
        subprocess.Popen(['/usr/bin/gpg', '--homedir', homedir, '--import', common.get_resource_path('securedrop.asc')]).wait()
        
        # verify the sig
        list_sig = common.get_resource_path('securedrop_list.txt.asc')
        p = subprocess.Popen(['/usr/bin/gpg', '--homedir', homedir, '--verify', list_sig])
        p.wait()
        if p.returncode != 0:
            shutil.rmtree(homedir)
            raise ListVerificationFailed
        
        # parse the list
        self.securedrop_list = []
        list_filename = common.get_resource_path('securedrop_list.txt')
        for line in open(list_filename, 'r').readlines():
            line = line.strip()
            if line.startswith('#'):
                continue
            
            org, landing_page, hs = line.split('\t')
            if org == 'Organization':
                continue
            
            self.securedrop_list.append({ 'org': org, 'landing_page': landing_page, 'hs': hs })
        
        # clean up temp files
        shutil.rmtree(homedir)
开发者ID:micahflee,项目名称:securedrop-client,代码行数:59,代码来源:client.py

示例9: validarUsuario

 def validarUsuario(self):
     log=Login(str(self.lineUsuario.text()), str(self.lineContrasenia.text()),
               self.mdi().window().getSesionBD())
     rol=log.loginValido()
     if (rol):
         self.mdi().hide()
         self.habilitarPermisos(rol)
     else:
         QtGui.QMessageBox.warning(self, 'Error', 'Usuario o Contraseña incorrecta.', 'Aceptar')
开发者ID:UNPSJB,项目名称:FarmaciaCrisol,代码行数:9,代码来源:lgIngresar.py

示例10: verify_cookie

 def verify_cookie(cls):
     with open(path.join(path.abspath('.'),'cookie.txt'),'r+',encoding='utf-8') as f:
         cookie = f.read()
     if cookie:
         cookies = json.loads(cookie)
         return cls(cookie=cookies)
     else:
         l = Login()
         l.login()
         return cls(cookie=Spider.verify_cookie())
开发者ID:smallDou,项目名称:spider_exercises,代码行数:10,代码来源:spider.py

示例11: post

	def post(self):
		username = self.request.get("username")
		password = self.request.get("password")
		login_obj = Login(username, password)
		if login_obj.get_user():
			cookies = login_obj.set_cookies()
			self.response.headers.add_header('Set-Cookie', 'name=%s; Path=/' % (cookies[0]))
			self.response.headers.add_header('Set-Cookie', 'user_id=%s; Path=/' % (cookies[1]))
			self.redirect("/blog/welcome")
		else:
			self.render("login.html", username=username, login_error="invalid login")
开发者ID:enmanuelar,项目名称:miniblog,代码行数:11,代码来源:main.py

示例12: login

def login(request,*kwargs):
	
	form = LoginForm(request.POST if request.POST else None)
	if form.is_valid():
		login = Login(request)
		if( login.makeLogin(form) ):
			return redirect('home-view')
		else:
			errors = form._errors.setdefault("systemerror", ErrorList())
			errors.append(u'Dados de login Invalidos')
	return render(request, 'login.html', {
		'form': form, 
	},)
开发者ID:ptnexus,项目名称:socialretail,代码行数:13,代码来源:views.py

示例13: test

    def test(self):
        storage = {}
        a = Admin(storage)
        l = Login(storage)

        a.addUser('fred', 's3cr3t')
        u = l.login('fred', 's3cr3t')
        self.assertTrue(u is not None)

        u2 = l.login('fred', 's3cr3t')
        self.assertTrue(u is u2)

        u3 = l.login('fred', 'password')
        self.assertTrue(u3 is None)
开发者ID:ogoodman,项目名称:serf,代码行数:14,代码来源:login_test.py

示例14: get

    def get(self):
        logging.debug("WebController.get()")
        user = Login().getIrssiUser(self.request.params)
        
        tokens = []
        irssi_script_version = 0
        registration_date = 'Aeons ago'
        last_notification_time = 'Never'
        notification_count = 0

        if user is not None:
            tokens = GcmToken.all()
            tokens.ancestor(user.key())
            tokens = tokens.fetch(10)
            for token in tokens:
                if token.registration_date is not None:
                    token.registration_date_string = token.registration_date
                else:
                    token.registration_date_string = 'Yesterday?'

            irssi_script_version = user.irssi_script_version
            if irssi_script_version == None:
                irssi_script_version = 0
                
            if user.registration_date is not None:
                registration_date = user.registration_date

            if user.last_notification_time is not None:
                last_notification_time = user.last_notification_time

            if user.notification_count is not None:
                notification_count = user.notification_count

        template_values = {
             'user': user,
             'tokens': tokens,
             'token_count': len(tokens),
             'logged_in': user is not None,
             'login_url': users.create_login_url("#profile").replace("&", "&"),
             'logout_url': users.create_logout_url("").replace("&", "&"),
             'irssi_working': last_notification_time != 'Never',
             'irssi_latest': irssi_script_version >= 13,
             'registration_date': registration_date,
             'last_notification_time': last_notification_time,
             'notification_count': notification_count
        }

        template = jinja_environment.get_template('html/index.html')
        self.response.out.write(template.render(template_values))
开发者ID:eiginn,项目名称:IrssiNotifier,代码行数:49,代码来源:main.py

示例15: __init__

	def __init__(self, stuid, pwd, io) :
		super(Student, self).__init__()
		global INFO
		INFO['id'] = stuid
		INFO['pwd'] = pwd

		self._LOGIN = Login(stuid,pwd,io)
		self._LOGIN_TAG = self._LOGIN.get_login_tag()
		self.is_login()

		self._HEADERS = self._LOGIN._HEADERS
		self._OPENER = self._LOGIN._OPENER

		self._VIEWSTATE = ""
		self._POST_DATA = {
							"hidLanguage":"",
							"ddlXN":"2011-2012",
							"ddlXQ":"2",
							"ddl_kcxz":"",
							"__VIEWSTATE":""
						}

		try:
			self.make_dir()
		except:
			print ("权限不足,当前目录不允许创建文件夹!")
			exit(1)
		try:
			self.get_SessionID()
			self.get_viewstate()
		except:
			print ("当前网络不稳定,请稍后再试!")
			exit(1)
开发者ID:ghy459,项目名称:Zhengfang_EducationAutomation_Client,代码行数:33,代码来源:student.py


注:本文中的login.Login类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。