# Path: duckpond/apps/editor/app.py
# def before_request():
# 
# Path: duckpond/apps/editor/forms.py
# class LoginForm(FlaskForm):
#     username = StringField('username', validators=[DataRequired()])
#     password = StringField('password', validators=[DataRequired()])
#     redirectonlogin = StringField('redirectonlogin', default='true',validators=[])


from flask import render_template, redirect, session, request, url_for, escape, flash, g, make_response, stream_with_context, Response
from functools import wraps
from .app import app
from .forms import LoginForm
from . import model
import json
import requests

@app.route('/')
def index():
   return render_template('home.html',
                           title='Duckpond Content Editor',
                           username=session['username'])
@app.route('/config.json')
def config():
   config = app.config.get('EDITOR_CONFIG')
   if config is None:
      config = { 'wrap-header' : ''}
   response = make_response(json.dumps(config))
   response.headers['Content-Type'] = "application/json; charset=utf-8"
   return response


@app.route('/login', methods=['GET', 'POST'])
def login():
   if 'username' in session:
      return redirect('/')

# Path: duckpond/apps/editor/app.py
# def before_request():
# 
# Path: duckpond/apps/editor/forms.py
# class LoginForm(FlaskForm):
#     username = StringField('username', validators=[DataRequired()])
#     password = StringField('password', validators=[DataRequired()])
#     redirectonlogin = StringField('redirectonlogin', default='true',validators=[])


# Path: duckpond/apps/editor/views.py
from flask import render_template, redirect, session, request, url_for, escape, flash, g, make_response, stream_with_context, Response
from functools import wraps
from .app import app
from .forms import LoginForm
from . import model
import json
import requests


@app.route('/')
def index():
   return render_template('home.html',
                           title='Duckpond Content Editor',
                           username=session['username'])
@app.route('/config.json')
def config():
   config = app.config.get('EDITOR_CONFIG')
   if config is None:
      config = { 'wrap-header' : ''}
   response = make_response(json.dumps(config))
   response.headers['Content-Type'] = "application/json; charset=utf-8"
   return response


@app.route('/login', methods=['GET', 'POST'])
def login():
   if 'username' in session:
      return redirect('/')

   form = LoginForm()