Exemplo n.º 1
0
def delsession(username):
    sessionobj = Sessions(username)
    session_id = sessionobj.readsessionid(username)
    sessionobj.delsession(session_id)
    resp = make_response(jsonify(status='success'), 200)
    # socket.
    return resp
Exemplo n.º 2
0
    def post(self, *args, **kwargs):
        try:
            login = self.get_argument_smart('username',
                                            as_get=False,
                                            as_post=True,
                                            as_session=False,
                                            as_cookie=False)
            passwd = self.get_argument_smart('passwd',
                                             as_get=False,
                                             as_post=True,
                                             as_session=False,
                                             as_cookie=False)
        except Exception as err:
            abort(403)

        try:
            passwd = sha.new(passwd).hexdigest()
        except:
            abort(403)
        user = session.query(Users).filter(Users.login == login).filter(
            Users.passwd == passwd).first()
        if user is None:
            abort(403)

        flask_session['session'] = Sessions().create(user.id)

        return Response(self.get_as_json())
Exemplo n.º 3
0
def on_join(data):
    sessionobj = Sessions(data['username'])
    username = data['username']
    room = sessionobj.readsessionid(data['room'])
    # room = data['room']
    # join_room(room)
    # send(username + ' has entered the room.', room=room)
    emit('sentdirect', data, room=room, include_self=False)
 def __init__(self, url, access_id, access_key):
     self.timer = Timer(Config.request_interval, self.task)
     self.sessions = Sessions()
     self.performance = Performance()
     self.url = url + Config.endpoint
     self.auth = (access_id, access_key)
     self.timestamp = int(time.time())
     self.start()
Exemplo n.º 5
0
def loginmsg(loggedin):
    print('This is {}'.format(loggedin))
    sessionobj = Sessions(loggedin['user'])
    sessionadded = sessionobj.addsession(request.sid)
    print(sessionadded)

    if sessionadded == 'error':
        # resp=make_response(jsonify(status='success'),200)
        resp = 'exist'
    else:
        # resp=make_response(jsonify(status='success'),200)
        emit('sessionadd',
             loggedin['user'],
             include_self=False,
             broadcast=True)
        resp = 'success'
    return resp
Exemplo n.º 6
0
 def dispatch(self, *args, **kwargs):
     Sessions().delete(self.request.user.id)
     return Response(redirect(url_for('admin:login')))
Exemplo n.º 7
0
from sessions import Sessions
import pprint

pp = pprint.PrettyPrinter(indent=4)
s = Sessions()
pp.pprint(s.get_session(148).get_session_mps())
Exemplo n.º 8
0
def addsessions(username):
    sessionobj = Sessions(username)
    sessionadded = sessionobj.addsession()
    resp = make_response(jsonify(status='success'), 200)
    return resp
Exemplo n.º 9
0
def getsession(username):
    sessionobj = Sessions(username)
    onlinesessions = sessionobj.readsession()
    resp = make_response(jsonify(sessions=onlinesessions), 200)
    return resp
Exemplo n.º 10
0
settings = dict(
    MOTOR_URI='mongodb://*****:*****@app.middleware('request')
async def add_session(request):
    request['session'] = session


app.config.AUTH_LOGIN_URL = '/Signin'
auth = Sessions(app)

from beacons.controllers.login import login_page
from beacons.controllers.map import map_page
from beacons.controllers.beacon import beacon_page
from beacons.controllers.photo_controller import photo_page

app.blueprint(login_page)
app.blueprint(map_page)
app.blueprint(beacon_page)
app.blueprint(photo_page)
Exemplo n.º 11
0
 def __init__(self, url):
     self.timer = Timer(Config.request_interval, self.task)
     self.sessions = Sessions()
     self.url = url
     self.timestamp = int(time.time())
     self.start()