Example #1
0
def login():
    username = quorum.get_field("username")
    password = quorum.get_field("password")
    try: account = models.Account.login(username, password)
    except quorum.OperationalError as error:
        return flask.render_template(
            "signin.html.tpl",
            username = username,
            error = error.message
        )

    # updates the current user (name) in session with
    # the username that has just be accepted in the login
    flask.session["username"] = account.username
    flask.session["tokens"] = account.tokens
    flask.session["instance_id"] = account.instance_id
    flask.session["nav_data"] = None

    # makes the current session permanent this will allow
    # the session to persist along multiple browser initialization
    flask.session.permanent = True

    return flask.redirect(
        flask.url_for("index")
    )
Example #2
0
def login():
    username = quorum.get_field("username")
    password = quorum.get_field("password")
    try: account = models.Account.login(username, password)
    except quorum.OperationalError as error:
        return flask.render_template(
            "signin.html.tpl",
            username = username,
            error = error.message
        )

    # updates the current user (name) in session with
    # the username that has just be accepted in the login
    flask.session["username"] = account.username
    flask.session["tokens"] = account.tokens
    flask.session["instance_id"] = account.instance_id
    flask.session["nav_data"] = None

    # makes the current session permanent this will allow
    # the session to persist along multiple browser initialization
    flask.session.permanent = True

    return flask.redirect(
        flask.url_for("index")
    )
Example #3
0
def show_contact(id):
    contact = models.Contact.get_i(id = id)
    return flask.render_template(
        "contact/show.html.tpl",
        link = "contacts",
        sub_link = "info",
        contact = contact
    )
Example #4
0
def show_account(username):
    account = models.Account.get(username = username)
    return flask.render_template(
        "account/show.html.tpl",
        link = "accounts",
        sub_link = "info",
        account = account
    )
Example #5
0
def new_account():
    return flask.render_template(
        "account/new.html.tpl",
        link = "accounts",
        sub_link = "create",
        account = {},
        errors = {}
    )
Example #6
0
def list_log(name):
    server = models.Server.get_i(name = name)
    return flask.render_template(
        "server/log.html.tpl",
        link = "servers",
        sub_link = "log",
        server = server
    )
Example #7
0
def list_log(name):
    server = models.Server.get_i(name = name)
    return flask.render_template(
        "server/log.html.tpl",
        link = "servers",
        sub_link = "log",
        server = server
    )
Example #8
0
def new_server():
    return flask.render_template(
        "server/new.html.tpl",
        link = "servers",
        sub_link = "create",
        server = {},
        errors = {}
    )
Example #9
0
def confirm(confirmation):
    # tries to set the account with the provided confirmation
    # code as enabled (only in case the confirmation code is valid)
    models.Account.confirmed(confirmation)

    return flask.render_template(
        "confirmed.html.tpl"
    )
Example #10
0
def show_server(name):
    server = models.Server.get_i(name = name)
    return flask.render_template(
        "server/show.html.tpl",
        link = "servers",
        sub_link = "info",
        server = server
    )
Example #11
0
def profile_server(name):
    server = models.Server.get(name = name)
    return flask.render_template(
        "site/server_profile.html.tpl",
        link = "servers",
        sub_link = "profile",
        server = server
    )
Example #12
0
def list_servers():
    servers = models.Server.find_i()
    return flask.render_template(
        "server/list.html.tpl",
        link = "servers",
        sub_link = "list",
        servers = servers
    )
Example #13
0
def profile_server(name):
    server = models.Server.get(name = name)
    return flask.render_template(
        "site/server_profile.html.tpl",
        link = "servers",
        sub_link = "profile",
        server = server
    )
Example #14
0
def new_server():
    return flask.render_template(
        "server/new.html.tpl",
        link = "servers",
        sub_link = "create",
        server = {},
        errors = {}
    )
Example #15
0
def list_contacts():
    contacts = models.Contact.find_i()
    return flask.render_template(
        "contact/list.html.tpl",
        link = "contacts",
        sub_link = "list",
        contacts = contacts
    )
Example #16
0
def new_contact():
    return flask.render_template(
        "contact/new.html.tpl",
        link = "contacts",
        sub_link = "create",
        contact = {},
        errors = {}
    )
Example #17
0
def new_account():
    return flask.render_template(
        "account/new.html.tpl",
        link = "accounts",
        sub_link = "create",
        account = {},
        errors = {}
    )
Example #18
0
def show_server(name):
    server = models.Server.get_i(name = name)
    return flask.render_template(
        "server/show.html.tpl",
        link = "servers",
        sub_link = "info",
        server = server
    )
Example #19
0
def show_account(username):
    account = models.Account.get(username = username)
    return flask.render_template(
        "account/show.html.tpl",
        link = "accounts",
        sub_link = "info",
        account = account
    )
Example #20
0
def confirm(confirmation):
    # tries to set the account with the provided confirmation
    # code as enabled (only in case the confirmation code is valid)
    models.Account.confirmed(confirmation)

    return flask.render_template(
        "confirmed.html.tpl"
    )
Example #21
0
def list_servers():
    servers = models.Server.find_i()
    return flask.render_template(
        "server/list.html.tpl",
        link = "servers",
        sub_link = "list",
        servers = servers
    )
Example #22
0
def edit_account(username):
    account = models.Account.get(username = username)
    return flask.render_template(
        "account/edit.html.tpl",
        link = "accounts",
        sub_link = "edit",
        account = account,
        errors = {}
    )
Example #23
0
def edit_contact(id):
    contact = models.Contact.get_i(id = id)
    return flask.render_template(
        "contact/edit.html.tpl",
        link = "contacts",
        sub_link = "edit",
        contact = contact,
        errors = {}
    )
Example #24
0
def edit_server(name):
    server = models.Server.get_i(name = name)
    return flask.render_template(
        "server/edit.html.tpl",
        link = "servers",
        sub_link = "edit",
        server = server,
        errors = {}
    )
Example #25
0
def edit_account(username):
    account = models.Account.get(username = username)
    return flask.render_template(
        "account/edit.html.tpl",
        link = "accounts",
        sub_link = "edit",
        account = account,
        errors = {}
    )
Example #26
0
def edit_server(name):
    server = models.Server.get_i(name = name)
    return flask.render_template(
        "server/edit.html.tpl",
        link = "servers",
        sub_link = "edit",
        server = server,
        errors = {}
    )
Example #27
0
def resend(username):
    # starts the confirmation process for the account this should
    # start sending the email to the created account
    account = models.Account.get(username = username, build = False)
    account.confirm()

    return flask.render_template(
        "pending.html.tpl",
        account = account
    )
Example #28
0
def resend(username):
    # starts the confirmation process for the account this should
    # start sending the email to the created account
    account = models.Account.get(username = username, build = False)
    account.confirm()

    return flask.render_template(
        "pending.html.tpl",
        account = account
    )
Example #29
0
def create_server():
    # creates the new server, using the provided arguments and
    # then saves it into the data source, all the validations
    # should be ran upon the save operation
    server = models.Server.new()
    try: server.save()
    except quorum.ValidationError as error:
        return flask.render_template(
            "server/new.html.tpl",
            link = "servers",
            sub_link = "create",
            server = error.model,
            errors = error.errors
        )

    # redirects the user to the show page of the server that
    # was just created
    return flask.redirect(
        flask.url_for("show_server", name = server.name)
    )
Example #30
0
def create_contact():
    # creates the new contact, using the provided arguments and
    # then saves it into the data source, all the validations
    # should be ran upon the save operation
    contact = models.Contact.new()
    try: contact.save()
    except quorum.ValidationError as error:
        return flask.render_template(
            "contact/new.html.tpl",
            link = "contacts",
            sub_link = "create",
            contact = error.model,
            errors = error.errors
        )

    # redirects the user to the show page of the contact that
    # was just created
    return flask.redirect(
        flask.url_for("show_contact", id = contact.id)
    )
Example #31
0
def create_server():
    # creates the new server, using the provided arguments and
    # then saves it into the data source, all the validations
    # should be ran upon the save operation
    server = models.Server.new()
    try: server.save()
    except quorum.ValidationError as error:
        return flask.render_template(
            "server/new.html.tpl",
            link = "servers",
            sub_link = "create",
            server = error.model,
            errors = error.errors
        )

    # redirects the user to the show page of the server that
    # was just created
    return flask.redirect(
        flask.url_for("show_server", name = server.name)
    )
Example #32
0
def update_server(name):
    # finds the current server and applies the provided
    # arguments and then saves it into the data source,
    # all the validations should be ran upon the save operation
    server = models.Server.get_i(name = name)
    server.apply()
    try: server.save()
    except quorum.ValidationError as error:
        return flask.render_template(
            "server/edit.html.tpl",
            link = "servers",
            sub_link = "edit",
            server = error.model,
            errors = error.errors
        )

    # redirects the user to the show page of the server that
    # was just updated
    return flask.redirect(
        flask.url_for("show_server", name = name)
    )
Example #33
0
def update_account(username):
    # finds the current account and applies the provided
    # arguments and then saves it into the data source,
    # all the validations should be ran upon the save operation
    account = models.Account.get(username = username)
    account.apply()
    try: account.save()
    except quorum.ValidationError as error:
        return flask.render_template(
            "account/edit.html.tpl",
            link = "accounts",
            sub_link = "edit",
            account = error.model,
            errors = error.errors
        )

    # redirects the user to the show page of the account that
    # was just updated
    return flask.redirect(
        flask.url_for("show_account", username = username)
    )
Example #34
0
def create_account():
    # creates the new account, using the provided arguments and
    # then saves it into the data source, all the validations
    # should be ran upon the save operation
    account = models.Account.new()
    try: account.save()
    except quorum.ValidationError as error:
        return flask.render_template(
            "account/new.html.tpl",
            link = "accounts",
            sub_link = "create",
            account = error.model,
            errors = error.errors
        )

    # redirects the user to the pending page, indicating that
    # the account is not yet activated and is pending the email
    # confirmation action
    return flask.redirect(
        flask.url_for("pending", username = account.username)
    )
Example #35
0
def update_server(name):
    # finds the current server and applies the provided
    # arguments and then saves it into the data source,
    # all the validations should be ran upon the save operation
    server = models.Server.get_i(name = name)
    server.apply()
    try: server.save()
    except quorum.ValidationError as error:
        return flask.render_template(
            "server/edit.html.tpl",
            link = "servers",
            sub_link = "edit",
            server = error.model,
            errors = error.errors
        )

    # redirects the user to the show page of the server that
    # was just updated
    return flask.redirect(
        flask.url_for("show_server", name = name)
    )
Example #36
0
def create_account():
    # creates the new account, using the provided arguments and
    # then saves it into the data source, all the validations
    # should be ran upon the save operation
    account = models.Account.new()
    try: account.save()
    except quorum.ValidationError as error:
        return flask.render_template(
            "account/new.html.tpl",
            link = "accounts",
            sub_link = "create",
            account = error.model,
            errors = error.errors
        )

    # redirects the user to the pending page, indicating that
    # the account is not yet activated and is pending the email
    # confirmation action
    return flask.redirect(
        flask.url_for("pending", username = account.username)
    )
Example #37
0
def update_contact(id):
    # finds the current contact and applies the provided
    # arguments and then saves it into the data source,
    # all the validations should be ran upon the save operation
    contact = models.Contact.get_i(id = id)
    contact.apply()
    try: contact.save()
    except quorum.ValidationError as error:
        return flask.render_template(
            "contact/edit.html.tpl",
            link = "contacts",
            sub_link = "edit",
            server = error.model,
            errors = error.errors
        )

    # redirects the user to the show page of the contact that
    # was just updated
    return flask.redirect(
        flask.url_for("show_contact", id = id)
    )
Example #38
0
def update_account(username):
    # finds the current account and applies the provided
    # arguments and then saves it into the data source,
    # all the validations should be ran upon the save operation
    account = models.Account.get(username = username)
    account.apply()
    try: account.save()
    except quorum.ValidationError as error:
        return flask.render_template(
            "account/edit.html.tpl",
            link = "accounts",
            sub_link = "edit",
            account = error.model,
            errors = error.errors
        )

    # redirects the user to the show page of the account that
    # was just updated
    return flask.redirect(
        flask.url_for("show_account", username = username)
    )
Example #39
0
def signin():
    return flask.render_template(
        "signin.html.tpl"
    )
Example #40
0
def home():
    return flask.render_template(
        "site/index.html.tpl",
        link = "home"
    )
Example #41
0
def list_accounts():
    return flask.render_template(
        "account/list.html.tpl",
        link = "accounts",
        sub_link = "list"
    )
Example #42
0
def docs_api():
    return flask.render_template(
        "site/docs_api.html.tpl",
        link = "home"
    )
Example #43
0
def index():
    return flask.render_template(
        "index.html.tpl",
        link = "home"
    )
Example #44
0
def about():
    return flask.render_template(
        "about.html.tpl",
        link = "about"
    )
Example #45
0
def pending(username):
    account = models.Account.get(username = username)
    return flask.render_template(
        "pending.html.tpl",
        account = account
    )
Example #46
0
def list_accounts():
    return flask.render_template(
        "account/list.html.tpl",
        link = "accounts",
        sub_link = "list"
    )
Example #47
0
def signin():
    return flask.render_template(
        "signin.html.tpl"
    )
Example #48
0
def home():
    return flask.render_template(
        "site/index.html.tpl",
        link = "home"
    )
Example #49
0
def docs_api():
    return flask.render_template(
        "site/docs_api.html.tpl",
        link = "home"
    )
Example #50
0
def index():
    return flask.render_template(
        "index.html.tpl",
        link = "home"
    )
Example #51
0
def about():
    return flask.render_template(
        "about.html.tpl",
        link = "about"
    )
Example #52
0
def pending(username):
    account = models.Account.get(username = username)
    return flask.render_template(
        "pending.html.tpl",
        account = account
    )