variables = dict(is_authenticated=current_user.is_authenticated)
    return render_template('terms_of_service.html', **variables)


@app.route("/logout")
def logout():
    if current_user.is_authenticated:
        current_user.is_authenticated = False
        logout_user()
    return redirect('/', code=302)


@app.errorhandler(401)
def not_logged_in(e):
    variables = dict(message='Please login first')

    return render_template('login_page.html', **variables)


@app.errorhandler(404)
def not_found(e):
    variables = dict(is_authenticated=current_user.is_authenticated,
                     message='404 Page non trouvée',
                     stacktrace=str(e))

    return render_template('error.html', **variables)


if __name__ == '__main__':
    app.run(host='localhost', port=app.config['BASE_PORT'])
        Removes all access to the services provided for paid subscriptions.

        Parameters
        ----------
        request : JSON data
            This is a payload from Stripe.

        Returns (JSON)
        -------
        message : string
            Empty string if the request went well. Contains debugging information
            if the request went bad.
        status : int
            HTTP status code.
    '''
    return action.subscription_ended(request)


@app.route("/get_all_stripe_subscriptions/<user_id>", methods=["GET"])
def get_all_stripe_subscriptions(user_id):
    return action.get_subscriptions(user_id, get_all=True)


@app.route("/get_active_subscription/<user_id>", methods=["GET"])
def get_active_subscription(user_id):
    return action.get_active_subscription(user_id)


if __name__ == '__main__':
    app.run(host='0.0.0.0', port=app.config['STRIPE_PORT'])
Exemplo n.º 3
0
    variables = dict(is_authenticated=current_user.is_authenticated)
    return render_template('terms_of_service.html', **variables)


@app.route("/logout")
def logout():
    if current_user.is_authenticated == True:
        current_user.is_authenticated = False
        logout_user()
    return redirect('/', code=302)


@app.errorhandler(401)
def not_logged_in(e):
    variables = dict(message='Please login first')

    return render_template('login_page.html', **variables)


@app.errorhandler(404)
def not_found(e):
    variables = dict(is_authenticated=current_user.is_authenticated,
                     message='404 Page Not Found',
                     stacktrace=str(e))

    return render_template('error.html', **variables)


if __name__ == '__main__':
    app.run(host='0.0.0.0', port=app.config['FRONTEND_PORT'])
Exemplo n.º 4
0
        {
            message : string 
                Returns the user object
        }
    '''
    return action.get_user_by_user_id(user_id)


@app.route("/getuser/email/<email>", methods=["GET"])
def get_user_by_email(email):
    '''
        Endpoint for getting a user by providing a user id.

        Parameters
        ----------
        request : JSON data
            Has to contain the user id.

        Returns (JSON)
        -------
        {
            message : string 
                Returns the user object
        }
    '''
    return action.get_user_by_email(email)


if __name__ == '__main__':
    app.run(host='0.0.0.0', port=app.config['USER_PORT'])
Exemplo n.º 5
0
import json
import os
import stripe
from flask import request
import traceback

# Import all the things
from setup_app import app
from notification_action import NotificationAction

action = NotificationAction(app)


@app.route("/notification_read", methods=["PUT"])
def notification_read():
    return action.notification_read(request)


@app.route("/get_notifications/<user_id>", methods=["GET"])
def get_notifications(user_id):
    return action.get_notifications(user_id)


@app.route("/get_unread_notifications/<user_id>", methods=["GET"])
def get_unread_notifications(user_id):
    return action.get_unread_notifications(user_id)


if __name__ == '__main__':
    app.run(host='0.0.0.0', port=app.config['NOTIFICATION_PORT'])