diff options
| author | Tres Seaver <tseaver@palladion.com> | 2024-06-10 12:09:42 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-10 12:09:42 -0400 |
| commit | ef0f6861e5b439afe43983f6c7437c30a413a34d (patch) | |
| tree | de670102b0123f2eea2ef399fd1e61cdfc5676b4 /docs/quick_tutorial/authentication | |
| parent | 72f61853beda8e21b669c3520e43fe3e5b224ba3 (diff) | |
| parent | 1ebd9884e712463057de38fb4948a56c0c0982c5 (diff) | |
| download | pyramid-ef0f6861e5b439afe43983f6c7437c30a413a34d.tar.gz pyramid-ef0f6861e5b439afe43983f6c7437c30a413a34d.tar.bz2 pyramid-ef0f6861e5b439afe43983f6c7437c30a413a34d.zip | |
Merge pull request #3760 from Pylons/tseaver-qt_cleanup
docs: quick tutorial cleanups
Diffstat (limited to 'docs/quick_tutorial/authentication')
| -rw-r--r-- | docs/quick_tutorial/authentication/tutorial/home.pt | 6 | ||||
| -rw-r--r-- | docs/quick_tutorial/authentication/tutorial/login.pt | 2 | ||||
| -rw-r--r-- | docs/quick_tutorial/authentication/tutorial/views.py | 7 |
3 files changed, 5 insertions, 10 deletions
diff --git a/docs/quick_tutorial/authentication/tutorial/home.pt b/docs/quick_tutorial/authentication/tutorial/home.pt index ed911b673..0e8508558 100644 --- a/docs/quick_tutorial/authentication/tutorial/home.pt +++ b/docs/quick_tutorial/authentication/tutorial/home.pt @@ -8,8 +8,10 @@ <div> <a tal:condition="view.logged_in is None" href="${request.application_url}/login">Log In</a> - <a tal:condition="view.logged_in is not None" - href="${request.application_url}/logout">Logout</a> + <span tal:condition="view.logged_in is not None"> + <a href="${request.application_url}/logout">Logout</a> + as ${view.logged_in} + </span> </div> <h1>Hi ${name}</h1> diff --git a/docs/quick_tutorial/authentication/tutorial/login.pt b/docs/quick_tutorial/authentication/tutorial/login.pt index 9e5bfe2ad..db8080fc8 100644 --- a/docs/quick_tutorial/authentication/tutorial/login.pt +++ b/docs/quick_tutorial/authentication/tutorial/login.pt @@ -8,8 +8,6 @@ <span tal:replace="message"/> <form action="${url}" method="post"> - <input type="hidden" name="came_from" - value="${came_from}"/> <label for="login">Username</label> <input type="text" id="login" name="login" diff --git a/docs/quick_tutorial/authentication/tutorial/views.py b/docs/quick_tutorial/authentication/tutorial/views.py index b2d9354ec..7c57d6371 100644 --- a/docs/quick_tutorial/authentication/tutorial/views.py +++ b/docs/quick_tutorial/authentication/tutorial/views.py @@ -33,10 +33,6 @@ class TutorialViews: def login(self): request = self.request login_url = request.route_url('login') - referrer = request.url - if referrer == login_url: - referrer = '/' # never use login form itself as came_from - came_from = request.params.get('came_from', referrer) message = '' login = '' password = '' @@ -46,7 +42,7 @@ class TutorialViews: hashed_pw = USERS.get(login) if hashed_pw and check_password(password, hashed_pw): headers = remember(request, login) - return HTTPFound(location=came_from, + return HTTPFound(location=request.route_url("home"), headers=headers) message = 'Failed login' @@ -54,7 +50,6 @@ class TutorialViews: name='Login', message=message, url=request.application_url + '/login', - came_from=came_from, login=login, password=password, ) |
