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 6dde02de
authored
Jan 16, 2026
by
aa.gustiana@gmail.com
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Perbaikan profile save apabilamenggunakan google login
1 parent
599afbe7
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
3 deletions
opensipkd/base/scripts/data/routes.csv
opensipkd/base/views/passcode-body.tpl
opensipkd/base/views/register.py
opensipkd/base/views/user_login.py
opensipkd/base/scripts/data/routes.csv
View file @
6dde02d
...
...
@@ -2,6 +2,7 @@ kode,path,module,file_name,class_name,func_name,order_id,permission,parent_id/ro
base-home,/,base,__init__,Home,view_home,1,,,Home,1,0,,0,home.pt,
base-login,/login,base,user_login,ViewAuth,view_login,1,,,Login,1,0,,0,form6.pt,1
base-logout,/logout,base,user_login,ViewAuth,view_logout,1,,,Logout,1,0,,0,logout.pt,
base-passcode,/passcode,,user_login,ViewPassword,get_passcode,,view,,Get Passcode,1,0,,0,json,
base-password-reset,/password/reset,base,user_login,ViewPassword,reset_password,,,,Reset Password,1,0,,0,form6.pt,
base-password,/password,base,user_login,ViewPassword,change_password,1,view,,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,
...
...
opensipkd/base/views/passcode-body.tpl
0 → 100644
View file @
6dde02d
We accepted passcode requests:
Your Passcode: $
{
passcode
}
This passcode will expire in $
{
minutes
}
minutes.
If you did not request this, please ignore it.
Be careful with your passcode.
\ No newline at end of file
opensipkd/base/views/register.py
View file @
6dde02d
...
...
@@ -165,7 +165,7 @@ class AddSchema(colander.Schema):
missing
=
colander
.
drop
,
)
if
request
.
user
and
request
.
user
.
id
and
not
external_user
:
if
request
.
user
and
request
.
user
.
id
:
self
[
"password"
]
=
colander
.
SchemaNode
(
colander
.
String
(),
widget
=
widget
.
PasswordWidget
(),
...
...
@@ -332,6 +332,16 @@ class Views(BaseView):
err_nik
()
if
'password'
in
value
:
external_user
=
user
and
user
.
external_identities
.
count
()
>
0
or
False
if
external_user
:
ext_user
=
UserService
.
by_user_name_and_security_code
(
user
.
user_name
,
value
[
'password'
])
if
not
ext_user
:
err_login
()
user
.
security_code
=
None
DBSession
.
add
(
user
)
DBSession
.
flush
()
else
:
if
not
user
or
not
UserService
.
check_password
(
user
,
value
[
'password'
]):
err_login
()
...
...
opensipkd/base/views/user_login.py
View file @
6dde02d
...
...
@@ -20,6 +20,7 @@ Perubahan Mendasar dari fungsi login adalah:
result object dari fungsi tersebut harus berupa class User()
"""
import
os
from
random
import
Random
import
re
from
datetime
import
timedelta
,
datetime
from
importlib
import
import_module
...
...
@@ -28,7 +29,7 @@ from pyramid.request import Response
import
colander
from
deform
import
widget
,
Form
,
ValidationFailure
,
Button
from
pyramid.csrf
import
new_csrf_token
,
get_csrf_token
from
pyramid.httpexceptions
import
HTTPFound
,
HTTPNotFound
from
pyramid.httpexceptions
import
HTTPFound
,
HTTPNotFound
,
HTTPNotAcceptable
from
pyramid.renderers
import
render_to_response
from
pyramid.security
import
remember
,
forget
from
pyramid_mailer.message
import
Message
...
...
@@ -197,7 +198,7 @@ def oauth2_login(request, params=None):
log
.
debug
(
"Users :
%
s"
,
user
)
log
.
debug
(
"IdInfo :
%
s"
,
id_info
)
if
id_info
and
not
user
:
# Insert ke
tabel user dan external identity
# Insert ke
values
=
{
'email'
:
id_info
[
'email'
],
"user_name"
:
id_info
[
"email"
],
"status"
:
1
,
...
...
@@ -614,6 +615,28 @@ class ViewPassword(BaseView):
request
.
session
.
flash
(
msg
)
return
HTTPFound
(
location
=
f
"{request.home}"
)
def
get_passcode
(
self
):
if
not
self
.
req
.
authenticated_userid
:
return
HTTPNotFound
(
"Anda harus login dahulu"
)
if
"mail.sender_name"
not
in
self
.
settings
or
'mail.username'
not
in
self
.
settings
:
return
HTTPNotAcceptable
(
"Anda harus login dahulu"
)
user
=
self
.
req
.
user
user
.
security_code
=
Random
()
.
randint
(
10000
,
99999
)
DBSession
.
add
(
user
)
DBSession
.
flush
()
minutes
=
two_minutes
data
=
dict
(
passcode
=
user
.
security_code
,
minutes
=
minutes
)
here
=
os
.
path
.
abspath
(
os
.
path
.
dirname
(
__file__
))
body_file
=
os
.
path
.
join
(
here
,
'passcode-body.tpl'
)
with
open
(
body_file
,
encoding
=
'utf-8'
)
as
f
:
body_tpl
=
f
.
read
()
subject
=
f
'{user.security_code} Verifikasi Passcode'
body_msg_id
=
'passcode-body'
body
=
_
(
body_msg_id
,
default
=
body_tpl
,
mapping
=
data
)
sending_mail
(
self
.
req
,
user
,
subject
,
body
)
return
dict
(
data
=
{
"message"
:
"Passcode sudah dikirim ke email Anda"
})
class
ChangePasswordRequest
(
colander
.
Schema
):
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