# Path: app/models/users.py
# def create_account(email, password, nickname):
# def get_user_by_email(email):
# def is_email_available(email):
# def is_valid_password(password):
# def is_correct_password(email, password):
# def update(id, **kw):
# def get_user_by_id(id):
# 
# Path: app/helpers/session.py
# def add_sessions_to_app(app):
# def get_session():
# def is_logged():
# def login(email):
# def logout():
# def reset():
# def get_user_id():
# def get_last_visited_url():
# def set_last_visited_url():
# def login_required(meth):
#     def new(*args):
# def login_required_for_reviews(meth):
#     def new(*l):
# 
# Path: app/helpers/email_templates.py
# def to_applicant(applicant):
# def to_applicant_simple(applicant):
# def to_referee(applicant):
# def notify_applicant(applicant):
# def notify_referee(applicant):
# def resend_password(user):


import web
from web import form
from app.models import users
from app.helpers import session
from app.helpers import email_templates
from config import view
        return render_account(show='all')

class login:
    def GET(self):
        return render_account(show='login_only')
    
    def POST(self):
        f = self.form()
        if not f.validates(web.input(_unicode=False)):
            show = web.input(show='all').show
            return render_account(show, login_form=f)
        else:
            session.login(f.d.email)
            raise web.seeother('/')
            #raise web.seeother(session.get_last_visited_url())
    
    def form(self):
        return login_form()
    
class register:
    def GET(self):
        return render_account(show='register_only')
    
    def POST(self):
        f = self.form()
        if not f.validates(web.input(_unicode=False)):
            show = web.input(show='all').show
            return render_account(show, register_form=f)
        else:
            users.create_account(f.d.email, f.d.password, f.d.nickname)

# Path: app/models/users.py
# def create_account(email, password, nickname):
# def get_user_by_email(email):
# def is_email_available(email):
# def is_valid_password(password):
# def is_correct_password(email, password):
# def update(id, **kw):
# def get_user_by_id(id):
# 
# Path: app/helpers/session.py
# def add_sessions_to_app(app):
# def get_session():
# def is_logged():
# def login(email):
# def logout():
# def reset():
# def get_user_id():
# def get_last_visited_url():
# def set_last_visited_url():
# def login_required(meth):
#     def new(*args):
# def login_required_for_reviews(meth):
#     def new(*l):
# 
# Path: app/helpers/email_templates.py
# def to_applicant(applicant):
# def to_applicant_simple(applicant):
# def to_referee(applicant):
# def notify_applicant(applicant):
# def notify_referee(applicant):
# def resend_password(user):


# Path: app/controllers/account.py
import web
from web import form
from app.models import users
from app.helpers import session
from app.helpers import email_templates
from config import view

        return render_account(show='all')

class login:
    def GET(self):
        return render_account(show='login_only')
    
    def POST(self):
        f = self.form()
        if not f.validates(web.input(_unicode=False)):
            show = web.input(show='all').show
            return render_account(show, login_form=f)
        else:
            session.login(f.d.email)
            raise web.seeother('/')
            #raise web.seeother(session.get_last_visited_url())
    
    def form(self):
        return login_form()
    
class register:
    def GET(self):
        return render_account(show='register_only')
    
    def POST(self):
        f = self.form()
        if not f.validates(web.input(_unicode=False)):
            show = web.input(show='all').show
            return render_account(show, register_form=f)
        else:
            users.create_account(f.d.email, f.d.password, f.d.nickname)

            session.login(f.d.email)