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 debce260
authored
Jul 31, 2025
by
aa.gustiana@gmail.com
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Update Recreate API Key
1 parent
16549d81
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
20 deletions
opensipkd/base/scripts/data/routes.csv
opensipkd/base/views/user_login.py
opensipkd/base/scripts/data/routes.csv
View file @
debce26
...
@@ -7,7 +7,7 @@ base-password,/password,base,user_login,ViewPassword,change_password,1,view,,Cha
...
@@ -7,7 +7,7 @@ base-password,/password,base,user_login,ViewPassword,change_password,1,view,,Cha
base-password-request,/password/{code}/request,base,user_login,ViewPassword,change_password_request,1,,,Change Password,1,0,,0,form8.pt,
base-password-request,/password/{code}/request,base,user_login,ViewPassword,change_password_request,1,,,Change Password,1,0,,0,form8.pt,
base-profile,/profile,base,register,,view_profile,,,,Profile,1,0,,0,form8.pt,
base-profile,/profile,base,register,,view_profile,,,,Profile,1,0,,0,form8.pt,
base-register,/register,base,register,,view_register,,,,Register,1,0,,0,form8.pt,
base-register,/register,base,register,,view_register,,,,Register,1,0,,0,form8.pt,
base-recreate-api-key,/recreate-api-key,base,
register
,ViewPassword,recreate-api-key,,,,Get Api Key,1,0,,0,recreate-api-key.pt,
base-recreate-api-key,/recreate-api-key,base,
user_login
,ViewPassword,recreate-api-key,,,,Get Api Key,1,0,,0,recreate-api-key.pt,
base-admin,#,base,,,,,view,,Administrator,1,0,,1,,
base-admin,#,base,,,,,view,,Administrator,1,0,,1,,
base-user,/user,base,user,,view_list,,user-view,base-admin,User,1,0,,1,form.pt,
base-user,/user,base,user,,view_list,,user-view,base-admin,User,1,0,,1,form.pt,
base-user-act,/user/{act}/act,base,user,,,,user-view,base-user,User Action,1,0,,,json,
base-user-act,/user/{act}/act,base,user,,,,user-view,base-user,User Action,1,0,,,json,
...
...
opensipkd/base/views/user_login.py
View file @
debce26
...
@@ -481,25 +481,25 @@ class ViewPassword(BaseView):
...
@@ -481,25 +481,25 @@ class ViewPassword(BaseView):
#
def view_recreate_api_key(self):
def
view_recreate_api_key
(
self
):
#
request = self.req
request
=
self
.
req
#
if not request.user.api_key:
if
not
request
.
user
.
api_key
:
#
return HTTPNotFound()
return
HTTPNotFound
()
#
schema = APIKey()
schema
=
APIKey
()
#
btn_submit = Button('recreate', _('Buat ulang'))
btn_submit
=
Button
(
'recreate'
,
_
(
'Buat ulang'
))
#
btn_cancel = Button('cancel', _('Batalkan'))
btn_cancel
=
Button
(
'cancel'
,
_
(
'Batalkan'
))
#
buttons = (btn_submit, btn_cancel)
buttons
=
(
btn_submit
,
btn_cancel
)
#
form = Form(schema, buttons=buttons)
form
=
Form
(
schema
,
buttons
=
buttons
)
#
if not request.POST:
if
not
request
.
POST
:
#
d = dict(api_key=request.user.api_key)
d
=
dict
(
api_key
=
request
.
user
.
api_key
)
#
return dict(form=form.render(appstruct=d))
return
dict
(
form
=
form
.
render
(
appstruct
=
d
))
#
if 'recreate' not in request.POST:
if
'recreate'
not
in
request
.
POST
:
#
return HTTPFound(location=f"{request.home}")
return
HTTPFound
(
location
=
f
"{request.home}"
)
#
request.user.api_key = api_key = generate_api_key()
request
.
user
.
api_key
=
api_key
=
generate_api_key
()
#
DBSession.add(request.user)
DBSession
.
add
(
request
.
user
)
#
msg = 'API Key Anda yang baru {}'.format(api_key)
msg
=
'API Key Anda yang baru {}'
.
format
(
api_key
)
#
request.session.flash(msg)
request
.
session
.
flash
(
msg
)
#
return HTTPFound(location=f"{request.home}")
return
HTTPFound
(
location
=
f
"{request.home}"
)
class
ChangePasswordRequest
(
colander
.
Schema
):
class
ChangePasswordRequest
(
colander
.
Schema
):
new_password
=
colander
.
SchemaNode
(
new_password
=
colander
.
SchemaNode
(
...
...
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