コード例 #1
0
ファイル: base.py プロジェクト: fdgonthier/kas
def init_session(ws, reinit=False):
    from kanp import KANP_MINOR

    if reinit:
        log.debug("Re-initializing session.")

        # Re-init session.
        session.clear()

        # Re-init KWMO permissions object.
        c.perms = KWMOPermissions()

    else:
        log.debug("Initializing session.")

    # Set session default variables.
    session['version'] = 1
    session['workspace_id'] = ws.id
    if ws.public: session['mode'] = MODE_PUBWS
    else: session['mode'] = MODE_WS
    if ws.compat_v2: session['kanp_minor'] = 2
    else: session['kanp_minor'] = KANP_MINOR
    session['user'] = None
    session['secure'] = bool(c.workspace.secured)
    session['last_perm_check_id'] = ws.last_perm_check_id
    session['last_evt_ws_id'] = ws.evt_ws_id
    session['last_evt_user_id'] = ws.evt_user_id
    session['initialized'] = True
    session['perms'] = c.perms.to_dict()
    session.save()
コード例 #2
0
ファイル: issues.py プロジェクト: maxwellc/libraryCRM
 def addIssue(self):
     memID = request.params['memberid']
     bkID = request.params['bookid']
     mem = Session.query(Members).filter_by(memberID=memID).first()
     member_allowance = Session.query(Issues).all()
     nameList = []
     for i in member_allowance:
         nameList.append(i.memberID)
     d = {}
     for i in set(nameList):
         d[i] = nameList.count(i)
     if d.get(int(memID), 1) > 2:
         session['flash'] = 'That member may not take out any more books.\
                 Maximum allowance of 3 reached.'
         session.save()
         #self.index()
     else:
         bk = Session.query(Books).filter_by(bookID=bkID).first()
         bk.status = False
         Session.add(bk)
         Session.commit()
         issueDate = datetime.date.today()
         dueDate = issueDate + datetime.timedelta(days=14)
         returned = False
         issue_details = Issues(mem.memberID, bk.bookID, issueDate,
                 dueDate, returned)
         Session.add(issue_details)
         Session.commit()
         session.clear()
         session['flash'] = 'Issue successfully added'
         session.save()
     redirect('/issues/')
コード例 #3
0
def init_session(ws, reinit=False):
    from kanp import KANP_MINOR

    if reinit:
        log.debug("Re-initializing session.")

        # Re-init session.
        session.clear()

        # Re-init KWMO permissions object.
        c.perms = KWMOPermissions()

    else:
        log.debug("Initializing session.")

    # Set session default variables.
    session['version'] = 1
    session['workspace_id'] = ws.id
    if ws.public: session['mode'] = MODE_PUBWS
    else: session['mode'] = MODE_WS
    if ws.compat_v2: session['kanp_minor'] = 2
    else: session['kanp_minor'] = KANP_MINOR
    session['user'] = None
    session['secure'] = bool(c.workspace.secured)
    session['last_perm_check_id'] = ws.last_perm_check_id
    session['last_evt_ws_id'] = ws.evt_ws_id
    session['last_evt_user_id'] = ws.evt_user_id
    session['initialized'] = True
    session['perms'] = c.perms.to_dict()
    session.save()
コード例 #4
0
ファイル: security.py プロジェクト: tonycai/pyfisheyes
    def submit(self):
        """
        Verify username and password
        """
        auth_passed = False
        # Both fields filled?
        username = request.params.get('username')
        password = request.params.get('password')

        #for auth in cfg.auth:
        #    if auth(username=username, password=password, config=cfg):
        if username == "test":
            auth_passed = True
        #        break

        # Mark user as logged in
        if auth_passed:
            session['user'] = username
            log.info(u"User %s logged in" % session['user'])
            session.save()

            # Send user back to the page he originally wanted to get to
            if session.get('path_before_login'):
                redirect(url(session['path_before_login']))
            else: # if previous target is unknown just send the user to a welcome page
                redirect('/')
        else:
            log.error("User %s login failed from host [%s]" % ( username, request.remote_addr))
            session.clear()
            session.save()
            return render('/login.mako')
コード例 #5
0
ファイル: security.py プロジェクト: tonycai/pyfisheyes
    def submit(self):
        """
        Verify username and password
        """
        auth_passed = False
        # Both fields filled?
        username = request.params.get('username')
        password = request.params.get('password')

        #for auth in cfg.auth:
        #    if auth(username=username, password=password, config=cfg):
        if username == "test":
            auth_passed = True
        #        break

        # Mark user as logged in
        if auth_passed:
            session['user'] = username
            log.info(u"User %s logged in" % session['user'])
            session.save()

            # Send user back to the page he originally wanted to get to
            if session.get('path_before_login'):
                redirect(url(session['path_before_login']))
            else:  # if previous target is unknown just send the user to a welcome page
                redirect('/')
        else:
            log.error("User %s login failed from host [%s]" %
                      (username, request.remote_addr))
            session.clear()
            session.save()
            return render('/login.mako')
コード例 #6
0
ファイル: accounts.py プロジェクト: TetraAsh/baruwa2
 def loggedout(self):
     "Logged out page"
     session.clear()
     session.save()
     came_from = (unquote(str(request.params.get('came_from', '')))
                 or url('/accounts/login'))
     redirect(url(came_from))
コード例 #7
0
 def logout(self):
     del session['user']
     if 'current_trip' in session:
         del session['current_trip']
     session.clear()
     session.save()
     tripsharing.cancel()
     redirect(h.url_for(controller='splash', action="index"))
コード例 #8
0
ファイル: splash.py プロジェクト: avl/SwFlightPlanner
 def logout(self):
     del session['user']
     if 'current_trip' in session:
         del session['current_trip']
     session.clear()
     session.save()
     tripsharing.cancel()
     redirect(h.url_for(controller='splash',action="index"))
コード例 #9
0
ファイル: auth.py プロジェクト: redvel2/simple_pylon_chat
 def logout(self):
     if session.get("email"):
         session.clear()
         session.save()
         if request.cookies.get("email"):
             response.delete_cookie("email")
             response.delete_cookie("password")
     redirect("/")
コード例 #10
0
ファイル: books.py プロジェクト: maxwellc/libraryCRM
 def deleteBook(self):
     bk_id = request.params['bkID']
     bk_details = self.book_q.filter_by(bookID=bk_id).first()
     Session.delete(bk_details)
     Session.commit()
     session.clear()
     session['flash'] = 'Book successfully deleted.'
     session.save()
     redirect('/books/')
コード例 #11
0
 def loggedout(self):
     "Logged out page"
     session.clear()
     if 'theme' in session:
         del session['theme']
     session.save()
     came_from = (unquote(str(request.params.get('came_from', '')))
                  or url('/accounts/login'))
     redirect(url(came_from))
コード例 #12
0
ファイル: usercontrol.py プロジェクト: AmurSU/orderman
 def dologin(self):
     session.clear()
     qloginer = meta.Session.query(model.Person)
     person = qloginer.filter_by(login=self.form_result['login']).first()
     # Загрузка информации о человеке и его правах доступа
     h.refresh_account(person.id)
     # Велкам!
     session['flash'] = u"Вы успешно вошли в систему"
     session.save()
     redirect_to(h.url_for(controller="main", action="index"))
コード例 #13
0
ファイル: base.py プロジェクト: mehulsbhatt/conference
 def __before__(self):
     if self.requires_auth and not session.get('logged_in'):
         if session.get('after_login') is None:
             session.clear()
             if url.current() != url(controller='auth/login', action='index'):
                 session['after_login'] = url.current()
             else:
                 session['after_login'] = url('/')
             session.save()
             
         redirect(url(controller='auth/login', action='index'))
コード例 #14
0
ファイル: books.py プロジェクト: maxwellc/libraryCRM
 def addBook(self):
     title = self.form_result['title']
     author = self.form_result['author']
     status = True
     bk_details = Books(title, author, status)
     Session.add(bk_details)
     Session.commit()
     session.clear()
     session['flash'] = 'Successfully added new book.'
     session.save()
     redirect('/books/')
コード例 #15
0
ファイル: twapi.py プロジェクト: pudo/tweetvote
def set_credentials(username, password):
    session['username'] = username
    session['password'] = password
    
    api =  create_api()
    if api:
        session['user_id'] = api.GetUser(api._username).id
    else:
        session.clear()
    session.save()
    return api
コード例 #16
0
ファイル: accounts.py プロジェクト: Pylons/kai
 def logout(self):
     c.user.session_id = None
     c.user.store(self.db)
     session.clear()
     session.expire()
     session.save()
     redir = request.GET.get('redir')
     success_flash('You have logged out of your session')
     if redir:
         redirect(url(str(redir)))
     else:
         redirect(url('home'))
コード例 #17
0
ファイル: members.py プロジェクト: maxwellc/libraryCRM
 def addMember(self):
     name = self.form_result['name']
     address = self.form_result['address']
     suburb = self.form_result['suburb']
     city = self.form_result['city']
     mem_details = Members(name, address, suburb, city)
     Session.add(mem_details)
     Session.commit()
     session.clear()
     session['flash'] = 'New member successfully added.'
     session.save()
     redirect('/members/')
コード例 #18
0
ファイル: books.py プロジェクト: maxwellc/libraryCRM
 def editBook(self):
     bk_id = request.params['id']
     bk_details = self.book_q.filter_by(bookID=bk_id).first()
     bk_details.title = self.form_result['title']
     bk_details.author = self.form_result['author']
     #bk_details.status = request.params['status']
     Session.add(bk_details)
     Session.commit()
     session.clear()
     session['flash'] = 'Book successfully edited.'
     session.save()
     redirect('/books/')
コード例 #19
0
ファイル: members.py プロジェクト: maxwellc/libraryCRM
 def editMember(self):
     mem_id = request.params['id']
     mem_details = self.member_q.filter_by(memberID=mem_id).first()
     mem_details.name = self.form_result['name']
     mem_details.address = self.form_result['address']
     mem_details.suburb = self.form_result['suburb']
     mem_details.city = self.form_result['city']
     Session.add(mem_details)
     Session.commit()
     session.clear()
     session['flash'] = 'Member successfully edited.'
     session.save()
     redirect('/members/')
コード例 #20
0
ファイル: accounts.py プロジェクト: haugvald/baruwa2
 def loggedout(self):
     "Logged out page"
     # response.delete_cookie('baruwacsrf')
     if 'lang' in session:
         lang = session['lang']
     session.clear()
     if 'lang' in locals():
         session['lang'] = lang
     session.save()
     #flash(_('You have been logged out !'))
     came_from = (unquote(str(request.params.get('came_from', '')))
                  or url('/accounts/login/'))
     redirect(url(came_from))
コード例 #21
0
ファイル: accounts.py プロジェクト: aureg/baruwa2
 def loggedout(self):
     "Logged out page"
     # response.delete_cookie('baruwacsrf')
     if 'lang' in session:
         lang = session['lang']
     session.clear()
     if 'lang' in locals():
         session['lang'] = lang
     session.save()
     #flash(_('You have been logged out !'))
     came_from = (unquote(str(request.params.get('came_from', '')))
     or url('/accounts/login/'))
     redirect(url(came_from))
コード例 #22
0
ファイル: issues.py プロジェクト: maxwellc/libraryCRM
 def deleteIssue(self):
     is_id = request.params['issueID']
     is_details = self.issue_q.filter_by(issueID=is_id).first()
     bk = Session.query(Books).filter_by(bookID=is_details.bookID).first()
     bk.status = True
     Session.add(bk)
     Session.commit()
     Session.delete(is_details)
     Session.commit()
     session.clear()
     session['flash'] = 'Issue successfully returned.'
     session.save()
     redirect('/issues/')
コード例 #23
0
ファイル: issues.py プロジェクト: maxwellc/libraryCRM
 def editIssue(self):
     is_id = request.params['id']
     is_details = self.issue_q.filter_by(issueID=is_id).first()
     is_details.memberID = request.params['memberID']
     is_details.bookID = request.params['bookID']
     i = datetime.datetime.strptime(request.params['issueDate'], '%Y-%m-%d')
     is_details.issueDate = i
     print is_details.issueDate, '*' * 500
     d = datetime.datetime.strptime(request.params['dueDate'], '%Y-%m-%d')
     is_details.dueDate = d
     Session.add(is_details)
     Session.commit()
     session.clear()
     session['flash'] = 'Issue successfully edited.'
     session.save()
     redirect('/issues/')
コード例 #24
0
ファイル: auth.py プロジェクト: sumukh210991/Cyberweb
    def signout(self):
        user = session.get('user') or request.environ.get('REMOTE_USER')
        if user:
            log.info("%s signed out." % user)
            # Hack to confirm logout of user.
            session.clear()
            session.save()
            if request.environ.has_key('REMOTE_USER'):
                del request.environ['REMOTE_USER']

        # The actual removal of the AuthKit cookie occurs when the response passes
        # through the AuthKit middleware, we simply need to display a page
        # confirming the user is signed out
        session.invalidate()

        redirect(url(controller='homepage', action='index'))
コード例 #25
0
ファイル: account.py プロジェクト: vickyi/PylonsSimpleCMS
    def post_logout(self):
        flash = None
        basket = None
        
        if session.has_key('flash'):
            flash = session['flash']
        if session.has_key('basket'):
            basket = session['basket']

        session.clear()
        
        if flash:
            session['flash']=flash
        if basket:
            session['basket'] = basket
            
        session.save()
        redirect(url(controller='home', action='index'))
        
コード例 #26
0
	def test_create_user(self):
		session['auth_type'] = 'facebook'
		session['auth_oid'] = '1234567890'
		session.save()
		
		res = create_user(session)
		self.assertNotEquals(res.id, None)
		self.assertEquals(res.name, None)
		self.assertEquals(res.type, 9)
		self.assertEquals(res.profile, None)
		self.assertEquals(res.open_id, None)
		self.assertEquals(res.fb_id, '1234567890')
		self.assertEquals(res.twitter_id, None)
		
		session.clear()
		session['auth_type'] = 'twitter'
		session['auth_oid'] = '1234567890'
		session.save()
		
		res = create_user(session)
		self.assertNotEquals(res.id, None)
		self.assertEquals(res.name, None)
		self.assertEquals(res.type, 9)
		self.assertEquals(res.profile, None)
		self.assertEquals(res.open_id, None)
		self.assertEquals(res.twitter_id, '1234567890')
		self.assertEquals(res.fb_id, None)
		
		session.clear()
		session['auth_type'] = 'openid'
		session['auth_oid'] = 'http://user.example.com'
		session.save()
		
		res = create_user(session)
		self.assertNotEquals(res.id, None)
		self.assertEquals(res.name, None)
		self.assertEquals(res.type, 9)
		self.assertEquals(res.profile, None)
		self.assertEquals(res.open_id, 'http://user.example.com')
		self.assertEquals(res.twitter_id, None)
		self.assertEquals(res.fb_id, None)
コード例 #27
0
 def signout(self):
     domain = request.params.get('domain')
     username = request.params.get('username')
     userid = request.params.get('userid')
     if domain and username or userid:
         try:
             keys = [k for k in session.get('account_keys', '').split(',') if k]
             rem_keys = keys[:]
             for k in keys:
                 acct = session[k]
                 if acct['domain']==domain and \
                    (not username or acct['username']==username) and \
                    (not userid or acct['userid']==userid):
                     session.pop(k)
                     rem_keys.remove(k)
             session['account_keys'] = ','.join(rem_keys)
         except:
             log.exception('failed to signout from domain %s', domain)
             session.clear()
     else:
         session.clear()
     session.save()
コード例 #28
0
ファイル: account.py プロジェクト: LeonardoXavier/f1
 def signout(self):
     domain = request.params.get('domain')
     username = request.params.get('username')
     userid = request.params.get('userid')
     if domain and username or userid:
         try:
             keys = [k for k in session.get('account_keys', '').split(',') if k]
             for k in keys:
                 session.pop(k)
             _and = [Account.domain==domain]
             if username:
                 _and.append(Account.username==username)
             if userid:
                 _and.append(Account.userid==userid)
             accts = Session.query(Account).filter(Account.key.in_(keys)).filter(not_(and_(*_and))).all()
             session['account_keys'] = ','.join([a.key for a in accts])
             for a in accts:
                 session[a.key] = a.to_dict()
         except:
             session.clear()
     else:
         session.clear()
     session.save()
コード例 #29
0
ファイル: account.py プロジェクト: mozilla/server-share
 def signout(self):
     domain = request.params.get('domain')
     username = request.params.get('username')
     userid = request.params.get('userid')
     if domain and username or userid:
         try:
             keys = [
                 k for k in session.get('account_keys', '').split(',') if k
             ]
             rem_keys = keys[:]
             for k in keys:
                 acct = session[k]
                 if acct['domain']==domain and \
                    (not username or acct['username']==username) and \
                    (not userid or acct['userid']==userid):
                     session.pop(k)
                     rem_keys.remove(k)
             session['account_keys'] = ','.join(rem_keys)
         except:
             log.exception('failed to signout from domain %s', domain)
             session.clear()
     else:
         session.clear()
     session.save()
コード例 #30
0
ファイル: account.py プロジェクト: teknikqa/f1
 def signout(self):
     domain = request.params.get("domain")
     username = request.params.get("username")
     userid = request.params.get("userid")
     if domain and username or userid:
         try:
             keys = [k for k in session.get("account_keys", "").split(",") if k]
             rem_keys = keys[:]
             for k in keys:
                 acct = session[k]
                 if (
                     acct["domain"] == domain
                     and (not username or acct["username"] == username)
                     and (not userid or acct["userid"] == userid)
                 ):
                     session.pop(k)
                     rem_keys.remove(k)
             session["account_keys"] = ",".join(rem_keys)
         except:
             log.exception("failed to signout from domain %s", domain)
             session.clear()
     else:
         session.clear()
     session.save()
コード例 #31
0
ファイル: logout.py プロジェクト: shafferj/thephotosync
 def index(self):
     session.clear()
     session.save()
     redirect(url('index'))
コード例 #32
0
ファイル: authentication.py プロジェクト: civicboom/civicboom
def signout_user(user):
    user_log.info("logged out")
    session.clear()
    cookie_delete("logged_in")
コード例 #33
0
ファイル: users.py プロジェクト: icheckmate/DARE-1
 def logout(self):
     session.clear()
     session.save()
     redirect(url('/'))
コード例 #34
0
ファイル: usercontrol.py プロジェクト: AmurSU/orderman
 def logout(self):
     session.clear()
     session['flash'] = u"Вы вышли из системы"
     session.save()
     redirect_to(h.url_for(controller="main", action="index", id=None))
コード例 #35
0
 def logout(self):
     session.clear()
     session.save()
     redirect(url(controller='index', action='index'))
コード例 #36
0
ファイル: auth.py プロジェクト: Emamatcyber90/Desio
def logout():

    session.clear()
    session.save()
コード例 #37
0
ファイル: account.py プロジェクト: howarth/mypoke
 def logout(self):
     session.clear()
     session.save()
     return redirect_to('/')
コード例 #38
0
ファイル: project.py プロジェクト: bulislaw/scalak
 def logout(self):
     session.clear()
     session.save()
     redirect(url(controller="auth", action="logout"))
コード例 #39
0
 def logout(self):
     session.clear()
     session.save()
     return render('/login.mako')
コード例 #40
0
ファイル: users.py プロジェクト: Python3pkg/DARE
 def logout(self):
     session.clear()
     session.save()
     redirect(url('/'))
コード例 #41
0
ファイル: auth.py プロジェクト: dyno/doorkeeper
 def logout(self):
     session.clear()
     session.save()
     return render('/login.mako')
コード例 #42
0
ファイル: Login.py プロジェクト: kblin/GSoC-SWAT
 def logout(self):
     # Clear all values in the session associated with the client
     session.clear()
     session.save()
     return json.dumps(self.successOK)
コード例 #43
0
ファイル: auth.py プロジェクト: Nullicopter/tethr
def logout():
    
    session.clear()
    session.save()
コード例 #44
0
ファイル: auth.py プロジェクト: freelizhun/pycloud
def signout():
    session.clear()
    session.save()