예제 #1
0
from eightglasses import app
app.run(debug=True)
예제 #2
0
      flash('Your goal could not be deleted. better keep at it.')
      return redirect(url_for('admin'))
  else:
    flash('Something went wrong with the form and your goal was not removed')
    return redirect(url_for('admin'))

@app.route('/login', methods=['GET', 'POST'])
def login():
  """ successful login drops you onto the home page.  """
  """ @@TODO: add support for ?next=                  """
  error = None
  if request.method == 'POST':
    if request.form['username'] != app.config['USERNAME']:
      error = 'Invalid username'
    elif request.form['password'] != app.config['PASSWORD']:
      error = 'Invalid password'
    else:
      session['logged_in'] = True
      flash('You were logged in')
      return redirect(url_for('home'))
  return render_template('login.html', error=error)

@app.route('/logout')
def logout():
  session.pop('logged_in', None)
  flash('You were logged out')
  return redirect(url_for('home'))

if __name__ == '__main__':
  app.run()
예제 #3
0
            'Something went wrong with the form and your goal was not removed')
        return redirect(url_for('admin'))


@app.route('/login', methods=['GET', 'POST'])
def login():
    """ successful login drops you onto the home page.  """
    """ @@TODO: add support for ?next=                  """
    error = None
    if request.method == 'POST':
        if request.form['username'] != app.config['USERNAME']:
            error = 'Invalid username'
        elif request.form['password'] != app.config['PASSWORD']:
            error = 'Invalid password'
        else:
            session['logged_in'] = True
            flash('You were logged in')
            return redirect(url_for('home'))
    return render_template('login.html', error=error)


@app.route('/logout')
def logout():
    session.pop('logged_in', None)
    flash('You were logged out')
    return redirect(url_for('home'))


if __name__ == '__main__':
    app.run()