Ejemplo n.º 1
0
def next_reduction():
    assert (make_next_param("/login", "http://localhost/profile") ==
            "/profile")
    assert (make_next_param("https://localhost/login", "http://localhost/profile") ==
            "http://localhost/profile")
    assert (make_next_param("http://accounts.localhost/login",
                            "http://localhost/profile") ==
            "http://localhost/profile")
Ejemplo n.º 2
0
def next_reduction():
    assert (make_next_param("/login",
                            "http://localhost/profile") == "/profile")
    assert (make_next_param(
        "https://localhost/login",
        "http://localhost/profile") == "http://localhost/profile")
    assert (make_next_param(
        "http://accounts.localhost/login",
        "http://localhost/profile") == "http://localhost/profile")
Ejemplo n.º 3
0
    def test_make_next_param(self):
        self.assertEqual("/profile", make_next_param("/login", "http://localhost/profile"))

        self.assertEqual(
            "http://localhost/profile", make_next_param("https://localhost/login", "http://localhost/profile")
        )

        self.assertEqual(
            "http://localhost/profile", make_next_param("http://accounts.localhost/login", "http://localhost/profile")
        )
Ejemplo n.º 4
0
    def test_make_next_param(self):
        self.assertEqual('/profile',
                         make_next_param('/login', 'http://localhost/profile'))

        self.assertEqual('http://localhost/profile',
                         make_next_param('https://localhost/login',
                                         'http://localhost/profile'))

        self.assertEqual('http://localhost/profile',
                         make_next_param('http://accounts.localhost/login',
                                         'http://localhost/profile'))
Ejemplo n.º 5
0
def unauthorized_handler():
    user_unauthorized.send(
        user_unauthorized.send(current_app._get_current_object()))
    url = URLObject(login_url(login_manager.login_view, request.url))
    prev_param = make_next_param(url.without_query(), request.referrer or '/')
    return redirect(
        url.add_query_param('prev',
                            prev_param).add_query_param('mode', 'action'))
Ejemplo n.º 6
0
def unauthorized_handler():
    user_unauthorized.send(user_unauthorized.send(current_app._get_current_object()))
    url = URLObject(login_url(login_manager.login_view, request.url))
    prev_param = make_next_param(url.without_query(), request.referrer or "/")
    return redirect(url.add_query_param("prev", prev_param).add_query_param("mode", "action"))