#219 Redirect the user to the page they are viewing after logging in
Merged 7 years ago by pingou. Opened 7 years ago by pingou.
pingou/fedora-hubs fix_login  into  develop

file modified
+2 -1
@@ -37,7 +37,8 @@ 

          </div>

          <img id="chaticon" class="pull-xs-right m-r-2" src="{{ url_for('static', filename='img/irc_icon.png') }}" alt="IRC Chats">

        {% else %}

-         Not logged in.  Click to <a href="{{url_for('login')}}">login</a>.

+         Not logged in.  Click to <a href="{{ url_for(

+             'login', next=request.url) }}">login</a>.

        {% endif %}

      </div>

      <div class="col-sm-4 col-sm-pull-4 col-xs-12">

no initial comment

This works for me

:thumbsup: good to merge after rebase


edit

Forgot to mention that the unittests don't pass

FAIL: test_hub_logged_out (hubs.tests.test_fedora_hubs_flask_api.HubsAPITest)
Traceback (most recent call last):
  File "/home/skrzepto/Documents/pull_request_review/fedora-hubs/hubs/tests/test_fedora_hubs_flask_api.py", line 48, in test_hub_logged_out
    self.assertTrue(str_expected in result.data)
AssertionError: False is not true

working on a patch now

diff --git a/hubs/tests/test_fedora_hubs_flask_api.py b/hubs/tests/test_fedora_hubs_flask_api.py \n    
index 7b7dbff..2a7f563 100644
--- a/hubs/tests/test_fedora_hubs_flask_api.py
+++ b/hubs/tests/test_fedora_hubs_flask_api.py
@@ -34,19 +34,15 @@ class HubsAPITest(hubs.tests.APPTest):
                              '/login">login</a>' in result.data)

    def test_hub_logged_out(self):
  -        with app.test_request_context('/ralph'):
  -            import flask
  -            flask.g.oidc_id_token = None
  -            # need to manually call the @app.before_request
  -            # since unittest don't call it
  -            hubs.app.check_auth()
  +        with tests.auth_set(app, None):  # check_auth doesn't load in unittest
                result = self.app.get('/ralph', follow_redirects=True)
  -            # assert the status code of the response
               self.assertEqual(result.status_code, 200)
  -            str_expected = 'Not logged in.  Click to ' \
  -                           '<a href="/login">login</a>'
  +            str_expected = '<h5>Ralph</h5>'
  +            self.assertTrue(str_expected in result.data)
  +            str_expected = 'Not logged in.'
               self.assertTrue(str_expected in result.data)

After discussing with @atelic in order for @skrzepto to keep the authorship of his work, we decided to merge this PR as is (well rebased) and let @skrzepto do a PR later to fix the tests :)

rebased

7 years ago

Pull-Request has been merged by pingou

7 years ago
Metadata