Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {% extends 'admin/master.html' %}
- {% block body %}
- {{ super() }}
- <script>
- //Submits an invalid authentication header, causing the user to be 'logged out'
- function logout() {
- $.ajax({
- type: "GET",
- url: "/admin/",
- dataType: 'json',
- async: true,
- username: "fake username",
- password: "fake password",
- data: '{ "comment" }'
- })
- //In our case, we WANT to get access denied, so a success would be a failure.
- .done(function(){
- alert('Error!')
- })
- //Likewise, a failure *usually* means we succeeded.
- //set window.location to redirect the user to wherever you want them to go
- .fail(function(){
- window.location = "/";
- });
- }
- </script>
- <!-- HTML button linked to the JS logout() function defined above -->
- <button type="button" onclick=logout()>End Session</button>
- <div class="container">
- <div class="row">
- <div class="col-sm-10 col-sm-offset-1">
- <h1>Admin View</h1>
- <p class="lead">
- The <a href="http://0.0.0.0:5000/admin/storedwords/">Stored Words</a> panel provides a management interface for the audio files recorded by participants.
- </p>
- <p>
- </p>
- </div>
- </div>
- </div>
- {% endblock body %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement