示例#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
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
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')