• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python auth.get_user_by_session函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: admin_login

    def admin_login(self, *args, **kwargs):
        auth = self.auth
        if not auth.get_user_by_session():
            self.redirect("/auth/login", abort=True)

        user = auth.get_user_by_session()
        if user and user["user_id"] == 5069036098420736:
            return handler(self, *args, **kwargs)
        else:
            self.redirect("/", abort=True)
开发者ID:Gogistics,项目名称:prjTWPublicMovements,代码行数:10,代码来源:handler_webapp2_extra_auth.py


示例2: admin_login

 def admin_login(self, *args, **kwargs):
     auth = self.auth
     if not auth.get_user_by_session():
         self.redirect('/auth/login', abort=True)
        
     user =  auth.get_user_by_session()
     queried_entity = User.get_by_id(user['user_id'])
     
     if queried_entity and queried_entity.phb_user_admin_status == 'admin-1':
         return handler(self, *args, **kwargs)
     else:
         self.redirect('/', abort = True)
开发者ID:Gogistics,项目名称:prjGogistics,代码行数:12,代码来源:handler_webapp2_extra_auth.py


示例3: setup

    def setup(self):
        params = {
            'admin': auth.get_user_by_session(),
            'auth_secret': model.AuthSecret.to_json(True)
        }

        self.render_response('setup.html', **params)
开发者ID:codervikash,项目名称:scribble,代码行数:7,代码来源:blog.py


示例4: check_login

 def check_login(self, *args, **kargs):
     auth = self.auth
     user = auth.get_user_by_session()
     if not user:
         self.redirect(self.uri_for('marketAuthenticate', callback=self.request.url))
     else:
         return handler(self, *args, **kargs)
开发者ID:EventBuck,项目名称:EventBuck,代码行数:7,代码来源:base_handler.py


示例5: check_login

 def check_login(self, *args, **kwargs):
   auth = self.auth
   logging.info(auth)
   if not auth.get_user_by_session():
     self.redirect('/')
   else:
     return handler(self, *args, **kwargs)
开发者ID:murilloric,项目名称:muvedo,代码行数:7,代码来源:accesscontrol.py


示例6: check_login

 def check_login(self, *args, **kwargs):
     auth = self.auth
     if not auth.get_user_by_session():
         # If handler has no login_url specified invoke a 403 error
         try:
             self.redirect(("/login?redirect=%s" % self.request.environ["PATH_INFO"]))
         except (AttributeError, KeyError), e:
             self.abort(403)
开发者ID:jivemonkey,项目名称:walking-challenge,代码行数:8,代码来源:main.py


示例7: check_login

	def check_login(self, *args, **kwargs):
		auth = self.auth
		if not auth.get_user_by_session():
			
			self.redirect('login/' + self.request.path.replace('/',''))
			#self.redirect(self.uri_for('login/' + self.request.path.replace('/','')), abort=True)
		else:
			return handler(self, *args, **kwargs)
开发者ID:jasondigitized,项目名称:quotationr,代码行数:8,代码来源:Oldmain.py


示例8: get

	def get(self):
		auth = self.auth
		if auth.get_user_by_session():
			user = self.user
			if user:
				self.redirect("/about")
		params = {}
		self.render_template('templates/home.html', params)
开发者ID:kevshi,项目名称:deviaTour,代码行数:8,代码来源:handlers.py


示例9: check_authentication

    def check_authentication(self, *args, **kwargs):
        auth = self.auth
        if not auth.get_user_by_session():
            self.redirect(self.uri_for('login'), abort=True)
        else:
            return handler(self, *args, **kwargs)

        return check_authentication
开发者ID:codervikash,项目名称:scribble,代码行数:8,代码来源:authentication.py


示例10: post

	def post(self):
		auth = self.auth
		if auth.get_user_by_session():
		
			userID = strip_tags(str(self.user_info['user_id']))
			userProfile = UserProfile.query(UserProfile.userID == userID).get()
			userProfile.ux = strip_tags(self.request.get('ux'))
			userProfile.put()
开发者ID:jasondigitized,项目名称:quotationr,代码行数:8,代码来源:Oldmain.py


示例11: check_login

 def check_login(self, *args, **kwargs):
     auth = self.auth
     if not auth.get_user_by_session():
         # If handler has no login_url specified invoke a 403 error
         try:
             self.redirect(self.auth_config['login_url'], abort=True)
         except (AttributeError, KeyError), e:
             self.abort(403)
开发者ID:doayakut,项目名称:CalTodo,代码行数:8,代码来源:base.py


示例12: check_login

 def check_login(self, *args, **kwargs):
     auth = self.auth
     u = auth.get_user_by_session()
     if not u:
         self.redirect(self.uri_for('login'), abort=True)
     elif u['isAdmin'] == False:
         self.redirect(self.uri_for('login'), abort=True)
     else:
         return handler(self, *args, **kwargs)
开发者ID:Trupal00p,项目名称:polymer-template,代码行数:9,代码来源:AuthHandler.py


示例13: check_login

 def check_login(self, *args, **kwargs):
     auth = self.auth
     g_user = None
     if users.get_current_user():
         g_user = self.user_model.get_by_auth_id(users.get_current_user().email())
     if not g_user and not auth.get_user_by_session():
         self.redirect(self.uri_for('login'), abort=True)
     else:
         return handler(self, *args, **kwargs)
开发者ID:esseti,项目名称:fantacalcio-mercato-libero,代码行数:9,代码来源:main.py


示例14: decorate

    def decorate(self, *args, **kwargs):
        auth = self.auth
        user = auth.get_user_by_session()

        if not user.is_admin:
            self.send_error(403, 'Not authorised, user is not a admin.')
            return

        return handlar(self, *args, **kwargs)
开发者ID:codervikash,项目名称:scribble,代码行数:9,代码来源:authentication.py


示例15: get

 def get(self):
     auth = get_auth(self.request)
     user = auth.get_user_by_session()
     if user is not None:
         return webapp2.redirect("/")
     api = get_brave_api()
     success = self.request.host_url + '/loginok'
     failure = self.request.host_url + '/login'
     result = api.core.authorize(success=success, failure=failure)
     return webapp2.redirect(result.location)
开发者ID:eve-val,项目名称:contract-watcher,代码行数:10,代码来源:main.py


示例16: check_login

 def check_login(self, *args, **kwargs):
     logging.info('---user_required-check login')
     auth = self.auth
     if not auth.get_user_by_session():
         logging.info('---not logged in!!!')
         #self.redirect(self.uri_for('login'), abort=True)
         self.redirect("/login", abort=True)
         #return False
     else:
         return handler(self, *args, **kwargs)
开发者ID:Izrg,项目名称:shoutwaves-master,代码行数:10,代码来源:authenticate.py


示例17: login

    def login(self):
        auth = self.auth
        if not auth.get_user_by_session():
            params = {
                'xsrf': authentication.CSRFHandlar().xsrf_token(
                    '/api/auth/login')
            }

            self.render_response('login.html', **params)
        else:
            self.redirect_to('dashboard')
开发者ID:codervikash,项目名称:scribble,代码行数:11,代码来源:blog.py


示例18: check_login

    def check_login(self, *args, **kwargs):
        # *args, **kwargs 関数定義に使用した場合、余った引数を受け取るタプル
        # どんな引数でも受け取ることが可能。

        auth = self.auth
        if not auth.get_user_by_session():
            # チェック 403 エラー
            try:
                self.redirect(self.auth_config['login_url'],abort=True)
            except (AttributeError, KeyError), e:
                self.abort(403)
开发者ID:tomo0111,项目名称:auth-webapp2,代码行数:11,代码来源:main.py


示例19: post

  def post(self):
    email = (self.request.get('email')).lower()
    password = self.request.get('password')
    auth = self.auth
    
    if not auth.get_user_by_session():
        accType = 'customer'
        customer = models.Customer()
    else:
        accType = self.request.get('accType')
        customer = models.Staff()
    
    customer.Email = email
    customer.First_Name = self.request.get('firstname')
    customer.Last_Name = self.request.get('lastname')
    customer.Contact_No = int(self.request.get('contact'))
    customer.Address = self.request.get('address')
    customer.postalCode = int(self.request.get('postalcode'))

    #unique_properties = ['email_address']
    acct_data = self.user_model.create_user(email, email_address=email, password_raw=password, first_name=customer.First_Name, accounType = accType, verified=False)
        
    if not mail.is_email_valid(email):
        self.display_message('invalid email entered')
        return
    
    if not acct_data[0]: #acct_data is a tuple
        self.display_message('Unable to create user for email %s because \
            it already exist' % (email))
        return
    
    customer.put()
    user = acct_data[1]
    user_id = user.get_id()

    token = self.user_model.create_signup_token(user_id)

    verification_url = self.uri_for('verification', type='v', user_id=user_id,
      signup_token=token, _full=True)

    msg = 'Send an email to user in order to verify their address. \
          They will be able to do so by visiting <a href="{url}">{url}</a>'
          
    message = mail.EmailMessage()
    message.sender = '[email protected]'
    message.to = email
    message.body = """
        testing email
        %s
        """ % msg.format(url=verification_url)
    message.Send()

    #self.display_message(msg.format(url=verification_url))
    self.display_message('A verification email has been sent to the respective email!')
开发者ID:bionickz,项目名称:bace,代码行数:54,代码来源:main.py


示例20: _serve_page

 def _serve_page(self, message= False, failed=False):
   username = self.request.get('username')
   auth = self.auth
   if not auth.get_user_by_session():
     params = {
       'username': username,
       'failed': failed,
       'message' : message
     }
     self.render_template('login.html', params)
   else:
     self.redirect(self.uri_for('authenticated'))
开发者ID:codervikash,项目名称:cornerstores.in,代码行数:12,代码来源:main.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python i18n._函数代码示例发布时间:2022-05-26
下一篇:
Python auth.get_auth函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap