Exemple #1
0
    def delete(self, parameters):
        deleteCount = 1
        session = meta.Session()
        jdata = json.loads(parameters)
        ids = []
        for key, value in jdata.iteritems():
            if key == 'deleteId':
                my_splitter = shlex.shlex(value, posix=True)
                my_splitter.whitespace += ','
                my_splitter.whitespace_split = True
                ids = list(my_splitter)
                break
        for id in ids:
            id = id.replace("\0", "")
            if id:
                id = int(id)
                accountObj = meta.Session.query(Account).filter(Account.id == id).one()
                accountObj.active = 0
                session.commit()
                self.jodis_connect(accountObj.id)
                session.delete(accountObj)
                deleteCount = deleteCount + 1

        session.commit()
        #meta.Session.close()

        return '{"message":"%d records deleted"}' % deleteCount
 def delete(self, parameters):
     session = meta.Session()
     deleteCount = 1
     jdata = json.loads(parameters)
     ids = []
     for key, value in jdata.iteritems():
         if key == 'deleteId':
             my_splitter = shlex.shlex(value, posix=True)
             my_splitter.whitespace += ','
             my_splitter.whitespace_split = True
             ids = list(my_splitter)
             break
     for id in ids:
         id = id.replace("\0", "")
         if id:
             id = int(id)
             resourceObj = meta.Session.query(Resource).filter(Resource.id == id).first()
             session.delete(resourceObj)
             if app_globals.available_resources.has_key(resourceObj.hostname):
                 del(app_globals.available_resources[resourceObj.hostname])
             deleteCount = deleteCount + 1
     
     session.commit()
     
     return '{"message":"%d records deleted"}' % deleteCount
Exemple #3
0
    def __call__(self, environ, start_response):
        """Invoke the Controller"""
        # WSGIController.__call__ dispatches to the Controller method
        # the request is routed to. This routing information is
        # available in environ['pylons.routes_dict']

        # Clean out any old cookies as they may contain api keys etc
        # This also improves the cachability of our pages as cookies
        # prevent proxy servers from caching content unless they have
        # been configured to ignore them.
        for cookie in request.cookies:
            if cookie.startswith('ckan') and cookie not in ['ckan']:
                response.delete_cookie(cookie)
            # Remove the ckan session cookie if not used e.g. logged out
            elif cookie == 'ckan' and not c.user and not h.are_there_flash_messages(
            ):
                if session.id:
                    if not session.get('lang'):
                        session.delete()
                else:
                    response.delete_cookie(cookie)
            # Remove auth_tkt repoze.who cookie if user not logged in.
            elif cookie == 'auth_tkt' and not session.id:
                response.delete_cookie(cookie)

        try:
            return WSGIController.__call__(self, environ, start_response)
        finally:
            model.Session.remove()
Exemple #4
0
    def __call__(self, environ, start_response):
        """Invoke the Controller"""
        # WSGIController.__call__ dispatches to the Controller method
        # the request is routed to. This routing information is
        # available in environ['pylons.routes_dict']

        # Clean out any old cookies as they may contain api keys etc
        # This also improves the cachability of our pages as cookies
        # prevent proxy servers from caching content unless they have
        # been configured to ignore them.
        for cookie in request.cookies:
            if cookie.startswith("ckan") and cookie not in ["ckan"]:
                response.delete_cookie(cookie)
            # Remove the ckan session cookie if not used e.g. logged out
            elif cookie == "ckan" and not c.user and not h.are_there_flash_messages():
                if session.id:
                    if not session.get("lang"):
                        session.delete()
                else:
                    response.delete_cookie(cookie)
            # Remove auth_tkt repoze.who cookie if user not logged in.
            elif cookie == "auth_tkt" and not session.id:
                response.delete_cookie(cookie)

        try:
            return WSGIController.__call__(self, environ, start_response)
        finally:
            model.Session.remove()
Exemple #5
0
 def _clearSession(self):
   if not self.uid is None:
     session['uid'] = None
     del(session['uid'])
     session.invalidate()
     session.save()
     session.delete()
 def logged_out(self):
     log.fatal("logged out")
     # we need to get our language info back and the show the correct page
     lang = session.get('lang')
     c.user = None
     session.delete()
     h.redirect_to(locale=lang, controller='ckanext.dgvat_por.controllers.dgvat_user:DgvatUserController', action='logged_out_page')    
Exemple #7
0
 def signout(self):
     # 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
     del session['user']
     session.delete()
     return render_jinja2('/account/singout.html')
Exemple #8
0
    def __call__(self, environ, start_response):
        """Invoke the Controller"""
        # WSGIController.__call__ dispatches to the Controller method
        # the request is routed to. This routing information is
        # available in environ['pylons.routes_dict']

        try:
            res = WSGIController.__call__(self, environ, start_response)
        finally:
            model.Session.remove()

        for cookie in request.cookies:
            # Remove the ckan session cookie if not used e.g. logged out
            if cookie == "ckan" and not c.user:
                # Check session for valid data (including flash messages)
                # (DGU also uses session for a shopping basket-type behaviour)
                is_valid_cookie_data = False
                for key, value in session.items():
                    if not key.startswith("_") and value:
                        is_valid_cookie_data = True
                        break
                if not is_valid_cookie_data:
                    if session.id:
                        self.log.debug("No valid session data - " "deleting session")
                        self.log.debug("Session: %r", session.items())
                        session.delete()
                    else:
                        self.log.debug("No session id - " "deleting session cookie")
                        response.delete_cookie(cookie)
            # Remove auth_tkt repoze.who cookie if user not logged in.
            elif cookie == "auth_tkt" and not session.id:
                response.delete_cookie(cookie)

        return res
Exemple #9
0
    def logout(self):
        """ Log out the user and display a confirmation message.
        """

        # remove session
        session.delete()

        return render('login.html')
Exemple #10
0
    def logout(self):
        """ Log out the user and display a confirmation message.
        """

        # remove session
        session.delete()

        return render('login.html')
Exemple #11
0
    def logout(self):
        """Logout user by deleting the session.

        :URL: ``POST /login/logout``.
        :returns: ``{"authenticated": False}``.

        """
        session.delete()
        return {'authenticated': False}
Exemple #12
0
    def logout(self):
        """Logout user by deleting the session.

        :URL: ``POST /login/logout``.
        :returns: ``{"authenticated": False}``.

        """
        session.delete()
        return {'authenticated': False}
Exemple #13
0
    def signin(self):
        if not h.auth.authorized(h.auth.is_valid_user):
            print ("chua dang nhap")
            if request.params:
                print ("vao day khong nhi ")
                user = Session.query(model.Users). \
                    filter_by(email=request.params['email'],
                              password=request.params['password']). \
                    first()
                if user:
                    print ("dang nhap roi")
                    session['user'] = user
                    session.save()

                    print (user.email)
                    if (user.email == '*****@*****.**'):
                        return redirect(h.url('signedin'))
                        # return redirect(url(controller='courses', action='index'))
                    else:
                        if user.user_info.active == 1:
                            return redirect(url(controller='students', action='show', id=user.id))
                        else:
                            session.delete()
                            return render_jinja2('/layout/not_active.html')

                    print (user)

                else:
                    return render_jinja2('/account/singin.html')
            else:
                print ("vao 1")
                return render_jinja2('/account/singin.html')
        else:
            print ("vao 2")

            c.user_group = Session.query(Users).filter_by(email=request.environ['REMOTE_USER']).first()
            print ("AABBBB")
            print (c.user_group.email == '*****@*****.**')
            if (c.user_group.email == '*****@*****.**'):
                return redirect(h.url('signedin'))
                #return redirect(url(controller='courses', action='index'))
            else :
                if c.user_group.user_info.active == 1 :
                    return redirect(url(controller='students', action='show', id = c.user_group.id))
                else:
                    session.delete()
                    return render_jinja2('/layout/not_active.html')

            user_group = Session.query(Users).filter_by(email=request.environ['REMOTE_USER']).first()
            print ("AABBBB")
            print (user_group.email == '*****@*****.**')
            if (user_group.email == '*****@*****.**'):
                return redirect(h.url('signedin'))
                #return redirect(url(controller='courses', action='index'))
            else :
                return redirect(url(controller='students', action='show', id = user_group.id))
 def logged_out(self):
     log.fatal("logged out")
     # we need to get our language info back and the show the correct page
     lang = session.get('lang')
     c.user = None
     session.delete()
     h.redirect_to(
         locale=lang,
         controller=
         'ckanext.dgvat_por.controllers.dgvat_user:DgvatUserController',
         action='logged_out_page')
Exemple #15
0
 def post_login(self):
     if c.user:
         url = h.base_url(c.instance)
         if 'came_from' in session:
             url = session.get('came_from')
             del session['came_from']
             session.save()
         h.flash(_("You have successfully logged in."), 'success')
         redirect(str(url))
     else:
         session.delete()
         return formencode.htmlfill.render(
             render("/user/login.html"),
             errors={"login": _("Invalid user name or password")})
Exemple #16
0
 def post_login(self):
     if c.user:
         url = h.base_url(c.instance)
         if 'came_from' in session:
             url = session.get('came_from')
             del session['came_from']
             session.save()
         h.flash(_("You have successfully logged in."), 'success')
         redirect(str(url))
     else:
         session.delete()
         return formencode.htmlfill.render(
             render("/user/login.html"),
             errors={"login": _("Invalid user name or password")})
Exemple #17
0
    def __call__(self, environ, start_response):
        """Invoke the Controller"""
        # WSGIController.__call__ dispatches to the Controller method
        # the request is routed to. This routing information is
        # available in environ['pylons.routes_dict']

        try:
            res = WSGIController.__call__(self, environ, start_response)
        finally:
            model.Session.remove()

        # Clean out any old cookies as they may contain api keys etc
        # This also improves the cachability of our pages as cookies
        # prevent proxy servers from caching content unless they have
        # been configured to ignore them.
        for cookie in request.cookies:
            if cookie.startswith('ckan') and cookie not in ['ckan']:
                response.delete_cookie(cookie)
            # Remove the ckan session cookie if not used e.g. logged out
            elif cookie == 'ckan' and not c.user:
                # Check session for valid data (including flash messages)
                # (DGU also uses session for a shopping basket-type behaviour)
                is_valid_cookie_data = False
                for key, value in session.items():
                    if not key.startswith('_') and value:
                        is_valid_cookie_data = True
                        break
                if not is_valid_cookie_data:
                    if session.id:
                        if not session.get('lang'):
                            self.log.debug(
                                'No session data any more - deleting session')
                            self.log.debug('Session: %r', session.items())
                            session.delete()
                    else:
                        response.delete_cookie(cookie)
                        self.log.debug(
                            'No session data any more - deleting session cookie'
                        )
            # Remove auth_tkt repoze.who cookie if user not logged in.
            elif cookie == 'auth_tkt' and not session.id:
                response.delete_cookie(cookie)

        return res
Exemple #18
0
def current_user():
    from ututi.model import User
    try:
        login = session.get('login', None)
        if login is None:
            return None
        login = int(login)
    except ValueError:
        return None

    session_secret = session.get('cookie_secret', None)
    cookie_secret = request.cookies.get('ututi_session_lifetime', None)

    if session_secret != cookie_secret:
        session.delete()
        response.delete_cookie('ututi_session_lifetime')
        return None

    return User.get_byid(login)
Exemple #19
0
    def __call__(self, environ, start_response):
        """Invoke the Controller"""
        # WSGIController.__call__ dispatches to the Controller method
        # the request is routed to. This routing information is
        # available in environ['pylons.routes_dict']

        try:
            res = WSGIController.__call__(self, environ, start_response)
        finally:
            model.Session.remove()

        # Clean out any old cookies as they may contain api keys etc
        # This also improves the cachability of our pages as cookies
        # prevent proxy servers from caching content unless they have
        # been configured to ignore them.
        for cookie in request.cookies:
            if cookie.startswith('ckan') and cookie not in ['ckan']:
                response.delete_cookie(cookie)
            # Remove the ckan session cookie if not used e.g. logged out
            elif cookie == 'ckan' and not c.user:
                # Check session for valid data (including flash messages)
                # (DGU also uses session for a shopping basket-type behaviour)
                is_valid_cookie_data = False
                for key, value in session.items():
                    if not key.startswith('_') and value:
                        is_valid_cookie_data = True
                        break
                if not is_valid_cookie_data:
                    if session.id:
                        if not session.get('lang'):
                            self.log.debug('No session data any more - '
                                           'deleting session')
                            self.log.debug('Session: %r', session.items())
                            session.delete()
                    else:
                        response.delete_cookie(cookie)
                        self.log.debug('No session data any more - '
                                       'deleting session cookie')
            # Remove auth_tkt repoze.who cookie if user not logged in.
            elif cookie == 'auth_tkt' and not session.id:
                response.delete_cookie(cookie)

        return res
Exemple #20
0
    def delete_player(self):
        session = Session()
        id = self.form_result['id']
        first = self.form_result['first']
        last = self.form_result['last']
        position = self.form_result['position']

        players = session.query(Player).filter_by(id=id,
                first=first,
                last=last,
                position=position).all()
        if len(players) <> 1:
            h.flash("The player was modified by someone else while you were staring at the screen!")
        else:
            player = players[0]
            session.delete(player)
            session.commit()
            h.flash("Player %s was deleted" % player.id)

        return h.redirect_to(controller='roster')
Exemple #21
0
    def __call__(self, environ, start_response):
        """Invoke the Controller"""
        # WSGIController.__call__ dispatches to the Controller method
        # the request is routed to. This routing information is
        # available in environ['pylons.routes_dict']

        # clean out any old cookies as they may contain api keys etc
        for cookie in request.cookies:
            if cookie.startswith('ckan') and cookie not in ['ckan', 'ckan_killtopbar']:
                response.delete_cookie(cookie)

            if cookie == 'ckan' and not c.user and not h.are_there_flash_messages():
                if session.id:
                    if not session.get('lang'):
                        session.delete()
                else:
                    response.delete_cookie(cookie)
        try:
            return WSGIController.__call__(self, environ, start_response)
        finally:
            model.Session.remove()
    def delete_player(self):
        session = Session()
        id = self.form_result['id']
        first = self.form_result['first']
        last = self.form_result['last']
        position = self.form_result['position']

        players = session.query(Player).filter_by(id=id,
                                                  first=first,
                                                  last=last,
                                                  position=position).all()
        if len(players) <> 1:
            h.flash(
                "The player was modified by someone else while you were staring at the screen!"
            )
        else:
            player = players[0]
            session.delete(player)
            session.commit()
            h.flash("Player %s was deleted" % player.id)

        return h.redirect_to(controller='roster')
Exemple #23
0
 def delete(self, parameters):
     session = meta.Session()
     deleteCount = 1
     jdata = json.loads(parameters)
     ids = []
     for key, value in jdata.iteritems():
         if key == 'deleteId':
             my_splitter = shlex.shlex(value, posix=True)
             my_splitter.whitespace += ','
             my_splitter.whitespace_split = True
             ids = list(my_splitter)
             break
     for id in ids:
         id = id.replace("\0", "")
         if id:
             id = int(id)
             queueTypeObj = meta.Session.query(QueueType).filter(QueueType.id == id).first()
             session.delete(queueTypeObj)
             deleteCount = deleteCount + 1
     
     session.commit()
     
     return '{"message":"%d records deleted"}' % deleteCount
Exemple #24
0
    def __call__(self, environ, start_response):
        """Invoke the Controller"""
        # WSGIController.__call__ dispatches to the Controller method
        # the request is routed to. This routing information is
        # available in environ['pylons.routes_dict']

        try:
            res = WSGIController.__call__(self, environ, start_response)
        finally:
            model.Session.remove()

        for cookie in request.cookies:
            # Remove the ckan session cookie if not used e.g. logged out
            if cookie == 'ckan' and not c.user:
                # Check session for valid data (including flash messages)
                # (DGU also uses session for a shopping basket-type behaviour)
                is_valid_cookie_data = False
                for key, value in session.items():
                    if not key.startswith('_') and value:
                        is_valid_cookie_data = True
                        break
                if not is_valid_cookie_data:
                    if session.id:
                        if not session.get('lang'):
                            self.log.debug('No session data any more - '
                                           'deleting session')
                            self.log.debug('Session: %r', session.items())
                            session.delete()
                    else:
                        response.delete_cookie(cookie)
                        self.log.debug('No session data any more - '
                                       'deleting session cookie')
            # Remove auth_tkt repoze.who cookie if user not logged in.
            elif cookie == 'auth_tkt' and not session.id:
                response.delete_cookie(cookie)

        return res
Exemple #25
0
 def post_logout(self):
     session.delete()
     redirect(h.base_url())
Exemple #26
0
	def adminlogout(self):
		session.delete()
		return render("adminlogin.mako")
Exemple #27
0
def UserLogout():
    session.delete()
Exemple #28
0
 def logged_out(self):
     # we need to get our language info back and the show the correct page
     lang = session.get('lang')
     c.user = None
     session.delete()
     h.redirect_to(locale=lang, controller='user', action='logged_out_page')
Exemple #29
0
 def sign_out(self):
     session["user"] = None
     session.delete()
     h.flash("You have been logged out.")
     redirect('/')
Exemple #30
0
def logout():
    session.pop(_auth_user_session_key, None)
    session.clear()
    session.delete()
Exemple #31
0
 def post_logout(self):
     session.delete()
     redirect(h.base_url(c.instance))
 def logout(self):
     session['iam_user'] = None
     session.delete()
Exemple #33
0
 def post_logout(self):
     session.delete()
     redirect(h.base_url(c.instance))
Exemple #34
0
 def signout(self):
     # del session['user']
     session.delete()
     return render('auth/signout.html')
Exemple #35
0
 def index(self):
     # Return a rendered template
     #return render('/logout.mako')
     # or, return a string
     session.delete()
     return redirect("http://saloon.tf/home/")
Exemple #36
0
 def logout(self):
     session.delete()
     host = config.get('auth.host')
     if not host:
         host = os.uname()[1]
     return redirect(url('http://' + host + ':' + config.get('auth.port') + config.get('auth.path')))
Exemple #37
0
def UserLogout():
	session.delete();
Exemple #38
0
 def logout(self):
     session.delete()
     log.info('Logging out and deleting session for user')
     redirect(url('home'))
 def destroy_user_session(self):
     cur_user = c.rhodecode_user
     log.info('Deleting session for user: `%s`', cur_user)
     session.delete()
Exemple #40
0
 def logout(self):
     session.delete()
     log.info('Logging out and deleting session for user')
     raise HTTPFound(location=url('home'))
Exemple #41
0
 def logout(self):
     session.delete()
     log.info('Logging out and deleting session for user')
     redirect(url('home'))
Exemple #42
0
 def index(self):
     # Return a rendered template
     #return render('/logout.mako')
     # or, return a string
     session.delete()
     return redirect("http://saloon.tf/home/")
Exemple #43
0
 def process(self):
     """Handle incoming redirect from OpenID Provider"""
     end_action = session.get('openid_action', 'login')
     
     oidconsumer = consumer.Consumer(self.openid_session, app_globals.openid_store)
     info = oidconsumer.complete(request.params, url('openid_process', qualified=True))
     if info.status == consumer.FAILURE and info.identity_url:
         fmt = "Verification of %s failed: %s"
         failure_flash(fmt % (info.identity_url, info.message))
     elif info.status == consumer.SUCCESS:
         openid_identity = info.identity_url
         if info.endpoint.canonicalID:
             # If it's an i-name, use the canonicalID as its secure even if
             # the old one is compromised
             openid_identity = info.endpoint.canonicalID
         
         # We've now verified a successful OpenID login, time to determine
         # how to dispatch it
         
         # First save their identity in the session, as several pages use 
         # this data
         session['openid_identity'] = openid_identity
         
         # Save off the session
         session.save()
         
         # First, if someone already has this openid, we log them in if
         # they've verified their email, otherwise we inform them to verify
         # their email address first
         users = list(Human.by_openid(self.db)[openid_identity])
         if users:
             user = users[0]
             if user.email_token:
                 failure_flash('You must verify your email before signing in.')
                 redirect(url('account_login'))
             else:
                 user.process_login()
                 success_flash('You have logged into PylonsHQ')
                 if session.get('redirect'):
                     redir_url = session.pop('redirect')
                     session.save()
                     redirect(url(redir_url))
                 redirect(url('home'))
         
         # Second, if this is a registration request, present the rest of
         # registration process
         if session.get('openid_action', '') == 'register':
             sreg_response = sreg.SRegResponse.fromSuccessResponse(info)
             results = {}
             
             # Just in case the user didn't provide sreg details
             if sreg_response:
                 results['displayname'] = sreg_response.get('fullname')
                 results['timezone'] = sreg_response.get('timezone')
                 results['email_address'] = sreg_response.get('email')
             c.defaults = results
             c.openid = openid_identity
             return render('/accounts/register.mako')
         
         # The last option possible, is that the user is associating this
         # OpenID account with an existing account
         c.openid = openid_identity
         return render('/accounts/associate.mako')
     elif info.status == consumer.CANCEL:
         failure_flash('Verification cancelled')
     elif info.status == consumer.SETUP_NEEDED:
         if info.setup_url:
             c.message = '<a href=%s>Setup needed</a>' % info.setup_url
         else:
             # This means auth didn't succeed, but you're welcome to try
             # non-immediate mode.
             failure_flash('Setup needed')
     else:
         failure_flash('Verification failed.')
     session.delete()
     proper_abort(end_action)
Exemple #44
0
	def userlogout(self):
		session.delete()
		return render("index.mako")