Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
T
Taiko Web
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
Taiko Web
Commits
816833ba
Commit
816833ba
authored
Mar 17, 2020
by
Bui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
handle csrf error
parent
1e7477dd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
+10
-2
app.py
app.py
+6
-2
public/src/js/strings.js
public/src/js/strings.js
+4
-0
No files found.
app.py
View file @
816833ba
...
...
@@ -14,7 +14,7 @@ from functools import wraps
from
flask
import
Flask
,
g
,
jsonify
,
render_template
,
request
,
abort
,
redirect
,
session
,
flash
from
flask_caching
import
Cache
from
flask_session
import
Session
from
flask_wtf.csrf
import
CSRFProtect
,
generate_csrf
from
flask_wtf.csrf
import
CSRFProtect
,
generate_csrf
,
CSRFError
from
ffmpy
import
FFmpeg
from
pymongo
import
MongoClient
...
...
@@ -23,7 +23,6 @@ client = MongoClient(host=config.MONGO['host'])
app
.
secret_key
=
config
.
SECRET_KEY
app
.
config
[
'SESSION_TYPE'
]
=
'redis'
app
.
config
[
'SESSION_COOKIE_HTTPONLY'
]
=
False
app
.
cache
=
Cache
(
app
,
config
=
config
.
REDIS
)
sess
=
Session
()
sess
.
init_app
(
app
)
...
...
@@ -86,6 +85,11 @@ def admin_required(level):
return
decorated_function
@
app
.
errorhandler
(
CSRFError
)
def
handle_csrf_error
(
e
):
return
api_error
(
'invalid_csrf'
)
@
app
.
before_request
def
before_request_func
():
if
session
.
get
(
'session_id'
):
...
...
public/src/js/strings.js
View file @
816833ba
...
...
@@ -1048,6 +1048,10 @@ var translations = {
verify_password_invalid
:
{
ja
:
null
,
en
:
"
Verification password does not match
"
,
},
invalid_csrf
:
{
ja
:
null
,
en
:
"
Security token expired. Please refresh the page.
"
}
},
browserSupport
:
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment