Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
aa.gusti
/
opensipkd-base
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 146af8c0
authored
Oct 21, 2025
by
aa.gustiana@gmail.com
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Enhance captcha validation logging in CaptchaWidget to improve error tracking
1 parent
765e0513
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
6 deletions
opensipkd/base/views/user_login.py
opensipkd/base/widgets/widget_os.py
opensipkd/base/views/user_login.py
View file @
146af8c
...
...
@@ -65,13 +65,14 @@ class Login(CSRFSchema):
colander
.
String
(),
widget
=
widget
.
PasswordWidget
())
def
after_bind
(
self
,
schema
,
kwargs
):
super
()
.
after_bind
(
schema
,
kwargs
)
request
=
kwargs
[
"request"
]
csrf_token
=
new_csrf_token
(
request
)
log
.
debug
(
csrf_token
)
self
[
"csrf_token"
]
=
colander
.
SchemaNode
(
colander
.
String
(),
widget
=
widget
.
HiddenWidget
(),
default
=
csrf_token
)
#
csrf_token = new_csrf_token(request)
#
log.debug(csrf_token)
#
self["csrf_token"] = colander.SchemaNode(
#
colander.String(), widget=widget.HiddenWidget(),
#
default=csrf_token
#
)
if
BASE_CLASS
.
login_captcha
:
self
[
"captcha"
]
=
colander
.
SchemaNode
(
colander
.
String
(),
...
...
opensipkd/base/widgets/widget_os.py
View file @
146af8c
...
...
@@ -402,11 +402,13 @@ class CaptchaWidget(Widget):
captcha_session
=
self
.
request
.
session
.
get
(
"captcha"
,
""
)
if
captcha_session
:
if
pstruct
!=
captcha_session
:
_logging
.
error
(
f
"Captcha tidak sesuai: {pstruct} != {captcha_session}"
)
raise
Invalid
(
field
.
schema
,
captcha_message
)
else
:
captcha_file
=
os
.
path
.
join
(
settings
[
'captcha_files'
],
pstruct
)
captcha_exists
=
os
.
path
.
exists
(
captcha_file
)
if
not
captcha_exists
:
_logging
.
error
(
f
"Captcha file not found: {captcha_file}"
)
raise
Invalid
(
field
.
schema
,
captcha_message
)
return
pstruct
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment