예제 #1
0
def login():
   """

   Args:
      {
         uname:
         pw:
      }

   Returns:
      {
         SUCCESS:
         error_message: (only if failure)
      }

   """
   if request.method == 'GET':
      return app.send_static_file('partials/login.html')
   else:
      # if user is already logged in, home should just take them to user home
			# but if they somehow get to index.html, they are able to log in again as normal
			# if session.has_key('logged_in') and session['logged_in']:
         # user is already logged in
         # return jsonify({'SUCCESS':True})
      try:
         user = db_util.get_user(request.json['uname'], request.json['pw'])
         session['logged_in'] = True
         session['id'] = user['id']
         session['uname'] = user['uname']
         return jsonify({'SUCCESS':True})
      except sqlite3.Error as e:
         return jsonify(Failure('login failed.'))
      except db_util.ValidationException as e:
         session['logged_in'] = False
         return jsonify(Failure('Invalid username or password'))
예제 #2
0
파일: views.py 프로젝트: PlexHaxx/plexible
def page_file(entry_id, file_id):
    full_data = get("/library/metadata/" + entry_id)["_children"][0]
    filename = full_data["_children"][0]["_children"][file_id]["file"]

    # FIXME: works only for unix-systems AND when script runs on same machine
    # serve file as static (strip trailing slash - it is added by the static
    # folder which is '/')
    return app.send_static_file(filename[1:])
예제 #3
0
def index():
    """
    First check if the user is logged in. If so, and he/she has an account, redirect him/her to the main search page.
    If not, redirect him/her to the intro page.
    """
    net_id = session.get(app.config['CAS_USERNAME_SESSION_KEY'], None)
    user = Profile.query.filter_by(net_id=net_id).first()
    if net_id is not None and user is not None:
        data = {"net_id": net_id, "profile": user}
        return render_template('action.html', data=data)
    else:
        return app.send_static_file('intro.html')
예제 #4
0
def after_login():
    login = session.get(app.config['CAS_USERNAME_SESSION_KEY'], None)

    user = User.query.filter_by(nickname=login).first()
    if user is None:
        nickname = login
        user = User(nickname=nickname, email=nickname+"@rice.edu")
        db.session.add(user)
        db.session.commit()

    remember_me = False
    if 'remember_me' in session:
        remember_me = session['remember_me']
        session.pop('remember_me', None)
    login_user(user, remember = remember_me)
    return app.send_static_file('intro.html') #temporarily redirecting user to intro page, TODO: figure out logic post-login
예제 #5
0
def root():
    if request.method == 'POST':
        Fname = request.form['first']
        Lname = request.form['last']
        email = request.form['email']
        netId = request.form['netId']
        heard = request.form['heard']
        heard = request.form['dietary']
        heard = request.form['hearmore']

        #Authenticate and create google sheet Obj -------

        json_key = json.load(open('rally-126a3be978da.json'))
        scope = ['https://spreadsheets.google.com/feeds']
        credentials = SignedJwtAssertionCredentials(json_key['client_email'], json_key['private_key'].encode(), scope)
        gc = gspread.authorize(credentials)
        wks = gc.open("testy").sheet1
        # -----------------------------------------------

        # Iterate through sheet find next empty cell-----
        def cellIterate():
            val = wks.acell('A1').value
            counter = 1
            while val:
                counter += 1
                cell = str('A' + str(counter))
                val = wks.acell(cell).value
                print counter
                pass
            return counter
        # -----------------------------------------------

        # Add person to google sheet --------------------

        cellNumber = cellIterate()
        wks.update_acell('A' + str(cellNumber), Fname)
        wks.update_acell('B' + str(cellNumber), Lname)
        wks.update_acell('C' + str(cellNumber), email)
        wks.update_acell('D' + str(cellNumber), netId)
        wks.update_acell('E' + str(cellNumber), heard)
        wks.update_acell('F' + str(cellNumber), dietary)
        wks.update_acell('G' + str(cellNumber), hearmore)
        #wks.update_acell('F' + str(cellNumber), ethnicity)
        # -----------------------------------------------
    return app.send_static_file('index.html')
예제 #6
0
def post_profile_pic():
    if request.method == 'POST':
        file = request.files['profile_pic']
        session_token = escape(session.get('token'))
        username = redis_connections.get(session_token)
        user = User.query.filter_by(username=username).first()

        if file and allowed_file(file.filename):
            filename = g.user.username + secure_filename(file.filename)
            file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
            user.profile_pic_filename = filename
            db.session.commit()

            return jsonify({'code':'200'})
        return jsonify({'code':'404'})
    else:
        session_token = escape(session.get('token'))
        username = redis_connections.get(session_token)
        user = User.query.filter_by(username=username).first()
        path = os.path.join(app.config['UPLOAD_FOLDER'], user.profile_pic_filename)
        return app.send_static_file(path)
예제 #7
0
파일: index.py 프로젝트: Amtron/cryptopia
def profile():
    return app.send_static_file('profile.html')
	
예제 #8
0
def index():
	#api_manager.create_api(tweets,methods=['GET','POST'])
	return app.send_static_file('index.html')
예제 #9
0
파일: index.py 프로젝트: lmorchard/CREM
def adminPage():
    return app.send_static_file('/views/admin.html')
예제 #10
0
파일: views.py 프로젝트: resal81/PryNotes
def old_browser():
    return app.send_static_file("old_browser.html")
예제 #11
0
def send_static(path):
    return app.send_static_file(path)
예제 #12
0
def message():
    return app.send_static_file('' + request.json['file'])
예제 #13
0
def static_proxy(path):
    return app.send_static_file(path)
예제 #14
0
def render_blog_img(src):
    # Blog static files
    return app.send_static_file('blog_posts/img/' + src)
예제 #15
0
def serve_story():
    return app.send_static_file('story/index.html')
예제 #16
0
def catch_all(path='index.html'):
    if os.path.isfile('public/' + path):
        return app.send_static_file(path)

    return abort(404)
예제 #17
0
def index():
    return app.send_static_file('index.html')
예제 #18
0
def index():
    return app.send_static_file(
        os.path.join('js', 'index.html').replace('\\', '/'))
예제 #19
0
def static_img(path):
    return app.send_static_file(os.path.join('img', path))
예제 #20
0
def get_slides():
  return app.send_static_file('slides.html')
예제 #21
0
def robots():
    return app.send_static_file('files/robots.txt')
예제 #22
0
def render_humans_txt():
    return app.send_static_file('public/humans.txt')
예제 #23
0
def apple_app_site_association():
    return app.send_static_file('files/apple-app-site-association.json')
def static_proxy(path):
    # send_static_file will guess the correct MIME type
    return app.send_static_file(os.path.join('js', path))
예제 #25
0
def demo():
    # This loads a static HTML file where we then hand over the interaction
    # to VueJS
    return app.send_static_file('partials/index.html')
예제 #26
0
def static_css(path):
    return app.send_static_file(os.path.join('css', path))
예제 #27
0
def root():
    """ Return the app index. """
    return app.send_static_file('index.html')
예제 #28
0
파일: views.py 프로젝트: imclab/lablr
def index():
    return app.send_static_file('html/index.html')
예제 #29
0
def catch_all(path):
	return app.send_static_file("index.html")
예제 #30
0
def create_session(uid):
    logger.info('New session opened for [' + uid + ']')
    return app.send_static_file("wall.html")
예제 #31
0
def send_text_file(file_name):
    """Send your static text file."""
    file_dot_text = file_name + '.txt'
    return app.send_static_file(file_dot_text)
예제 #32
0
def sendrobot():
    return app.send_static_file("robots.txt")
예제 #33
0
def frontend_files(url):
    return app.send_static_file(url)
예제 #34
0
def home():
    return app.send_static_file("home.html")
예제 #35
0
def _hook():
    return app.send_static_file(request.path[1:])
예제 #36
0
def download_file(filename):
    return app.send_static_file(filename)
예제 #37
0
def VwqXrMRgdzjBpP69cSt6LhLHYAwCwyFA():
    return app.send_static_file('promotion.html')
예제 #38
0
def get_topics():
  return app.send_static_file('topics.html')
예제 #39
0
def root():
    return app.send_static_file('index.html')
예제 #40
0
def render_robots_txt():
    return app.send_static_file('public/robots.txt')
예제 #41
0
def get_img(img):
    return app.send_static_file(filename="img/%s" % (img))
예제 #42
0
def render_blog_video(src):
    # Blog video files
    return app.send_static_file('blog_posts/video/' + src)
예제 #43
0
def getControllerView():
    return app.send_static_file('dbgame/views/controller.html')
예제 #44
0
파일: views.py 프로젝트: pradal/noworkflow
def static_proxy(path):
    return app.send_static_file(path)
예제 #45
0
def getD():
    return app.send_static_file('dbgame/views/directive.html')
예제 #46
0
파일: views.py 프로젝트: lorenmh/day2data
def static_file(path):
    return app.send_static_file(os.path.join('static', path))
예제 #47
0
def send_text_file(file_name):
    file_dot_text = file_name + '.txt'
    return app.send_static_file(file_dot_text)
예제 #48
0
def send_text_file(file_name):
    """Send your static text file."""
    file_dot_text = file_name + '.txt'
    return app.send_static_file(file_dot_text)
예제 #49
0
def login():
    return app.send_static_file('login.html')