Debian Codegraph @

example_app/templates/index.html

raw
1 {#
2 # Copyright 2015 Google Inc.
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 #}
16 <!doctype html>
17 <html>
18 <head>
19 <title>Talisman sample app</title>
20 </head>
21 <body>
22
23 <h1>Talisman + Seasurf Sample</h1>
24
25 {% if message: %}
26 <h3>Your message:</h3>
27 <div>{{message}}</div>
28 {% endif %}
29
30 <form method="POST">
31 <input type="hidden" name="_csrf_token" value="{{csrf_token()}}">
32 <textarea name="message" placeholder="Enter message..."></textarea>
33 <button type="submit">Submit</button>
34 </form>
35
36 <script>
37 // This script is forbidden
38 console.log("Oh no, this should not have run!!")
39 </script>
40
41 <script nonce="{{ csp_nonce() }}">
42 // This one isn't
43 console.log("Yay, nonce allowed to run this.")
44 navigator.geolocation.getCurrentPosition(function(position) {
45 console.log('Oh no, geolocation access should be denied');
46 });
47 </script>
48
49 </body>
50 </html>