Ejemplo n.º 1
0
def ga_track_draw(bom_draw, action):
    """Sends a notification of action to google analytics

    :bom_draw: draw to send information about
    :action: action to send
    """
    shared_type = 'public' if bom_draw.is_shared else 'private'
    ga_track_event(category=action, action=bom_draw.draw_type, label=shared_type)
Ejemplo n.º 2
0
def register(request):
    """Registers a user
    Serves a web to register the user
    Register and logs the user in if POST data is provided
    """
    logout(request)
    context = {}
    if request.POST:
        email = request.POST['email']
        password = request.POST['password']
        u = User(email)
        u.set_password(password)
        try:
            MONGO.create_user(u)
            ga_track_event(category="user", action="registration")
            return login_user(request)
        except Exception:
            context = {'error': _("The email is already registered.")}
    return render(request, 'register.html', context)