Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Password Validation PowerBuilder 6

Status
Not open for further replies.

fathee

Programmer
Apr 28, 2017
3
Hi all,

i'm newly join the company and i got task to do with password validation.

1- Min 8 Character
2- must consist (A-Z, a-z, 0-9)

We use PowerBuilder 6 and connect to ODBC. I plan to change in Window Object. Anyone can help me? Attach are the fully script for that window
 
 http://files.engineering.com/getfile.aspx?folder=3719f49a-307e-4b9a-9d6b-dfa4b962a66b&file=Password_Checking.txt
The code you provided is from some sort of log on window which gets the user id and password from the registry, encrypts it, then attempts to connect to the database.

Your question appears to be about enforcing some rules on password length and contents.

You should enforce the password rules in whichever window is used to change passwords.

Matt

"Nature forges everything on the anvil of time"
 
Thanks for reply. So, i need to find which window that that used to change password right.
 
i made login and password for user

string ls_name[],ls_nama[],ls_pass[]
decimal ldec_nilai[]

dw_1.accepttext()
ls_name[1] = dw_1.Object.uslognm[dw_1.GetRow()] // login user
ls_nama[1] = dw_1.Object.usfullnm[dw_1.GetRow()] // full name user
ls_pass[1] = dw_1.Object.uspass[dw_1.GetRow()] // password user

// for check if login has used
SELECT ISNULL(COUNT(USERLOG.USLOGNM),0)
INTO :ldec_nilai[1]
FROM USERLOG
WHERE USERLOG.USLOGNM = :ls_name ;
COMMIT USING SQLCA;

// for check if full name user has used
SELECT ISNULL(COUNT(USERLOG.USFULLNM),0)
INTO :ldec_nilai[2]
FROM USERLOG
WHERE USERLOG.USFULLNM = :ls_nama ;
COMMIT USING SQLCA;

// dw_3 = dw_1 and for check between dw_3 and dw_1
if dw_3.Retrieve(is_userlog) > 0 then
ls_name[2] = dw_3.Object.uslognm[dw_1.GetRow()]
ls_nama[2] = dw_3.Object.usfullnm[dw_1.GetRow()]
ls_pass[2] = dw_3.Object.uspass[dw_1.GetRow()]
end if

if ls_name <> 'ADMIN' then
//nama login // login user
If dw_1.object.uslognm[dw_1.getRow()] = '' Or &
IsNull(dw_1.object.uslognm[dw_1.getRow()]) Then
MessageBox('Data belum lengkap','Nama Login Masih Kosong ~n' &
+'Silahkan di Isi Dahulu',StopSign! )
dw_1.SetFocus()
dw_1.SetColumn('uslognm')
Return
End If

if ldec_nilai[1] > 0 and ls_name1 <> ls_name then
MessageBox('Data belum lengkap','Nama Login Sudah Ada ~n' &
+'Silahkan Buat Yang Baru',StopSign! )
dw_1.SetFocus()
dw_1.SetColumn('uslognm')
Return
End If

if len(ls_name) < 3 then
MessageBox('Data belum lengkap','Nama Login Minimal 3 Digit ~n' &
+'Silahkan di Ubah Dahulu',StopSign! )
dw_1.SetFocus()
dw_1.SetColumn('uslognm')
Return
End If

if match(ls_name, '^[a-zA-Z0-9 ]+$') = FALSE then
MessageBox('Data belum lengkap',+ 'Nama Login di Isi Dengan Angka dan atau Huruf ~n' &
+ 'Silahkan di Ubah Dahulu',StopSign! )
dw_1.SetFocus()
dw_1.SetColumn('uslognm')
Return
End If

//nama pemakai // full name user
If dw_1.object.uslognm[dw_1.getRow()] = '' Or &
IsNull(dw_1.object.usfullnm[dw_1.getRow()]) Then
MessageBox('Data belum lengkap','Nama Pemakai Masih Kosong ~n' &
+'Silahkan di Isi Dahulu',StopSign! )
dw_1.SetFocus()
dw_1.SetColumn('usfullnm')
Return
End If

if ldec_nilai[2] > 0 and ls_nama1 <> ls_nama then
MessageBox('Data belum lengkap','Nama Pemakai Sudah Ada ~n' &
+'Silahkan Buat Yang Baru',StopSign! )
dw_1.SetFocus()
dw_1.SetColumn('usfullnm')
Return
End If

if len(ls_nama) < 3 then
MessageBox('Data belum lengkap','Nama Pemakai Minimal 3 Digit ~n' &
+'Silahkan di Ubah Dahulu',StopSign! )
dw_1.SetFocus()
dw_1.SetColumn('usfullnm')
Return
End If

if match(ls_nama, '^[a-zA-Z0-9 ]+$') = FALSE then
MessageBox('Data belum lengkap',+ 'Nama Pemakai di Isi Dengan Angka dan atau Huruf ~n' &
+ 'Silahkan di Ubah Dahulu',StopSign! )
dw_1.SetFocus()
dw_1.SetColumn('usfullnm')
Return
End If

//Password
If dw_1.object.uspass[dw_1.getRow()] = '' Or &
IsNull(dw_1.object.uspass[dw_1.getRow()]) Then
MessageBox('Data belum lengkap','Password Masih Kosong ~n' &
+'Silahkan di Isi Dahulu',StopSign! )
dw_1.SetFocus()
dw_1.SetColumn('uspass')
Return
End If

if len(ls_pass) < 3 then
MessageBox('Data belum lengkap','Password Minimal 3 Digit ~n' &
+'Silahkan di Ubah Dahulu',StopSign! )
dw_1.SetFocus()
dw_1.SetColumn('uspass')
Return
End If

//first digit must filled number or alphabet
if match(ls_pass, '^[a-zA-Z0-9 ]+$') = FALSE then
MessageBox('Data belum lengkap',+ 'Password di Isi Dengan Angka dan atau Huruf ~n' &
+ 'Silahkan di Ubah Dahulu',StopSign! )
dw_1.SetFocus()
dw_1.SetColumn('uspass')
Return
End If

// login not must be same with full name
if ls_name = ls_nama then
MessageBox('Data belum lengkap',+ 'Nama Login dan Nama Pemakai Tidak Boleh Sama ~n' &
+ 'Silahkan di Ubah Salah Satu Dahulu',StopSign! )
dw_1.SetFocus()
dw_1.SetColumn('usfullnm')
Return
end if

// login not must be same with password
if ls_name = ls_pass then
MessageBox('Data belum lengkap',+ 'Nama Login dan Password Tidak Boleh Sama ~n' &
+ 'Silahkan di Ubah Salah Satu Dahulu',StopSign! )
dw_1.SetFocus()
dw_1.SetColumn('uspass')
Return
end if

// password not must be same with full name
if ls_nama = ls_pass then
MessageBox('Data belum lengkap',+ 'Nama Pemakai dan Password Tidak Boleh Sama ~n' &
+ 'Silahkan di Ubah Salah Satu Dahulu',StopSign! )
dw_1.SetFocus()
dw_1.SetColumn('usfullnm')
Return
end if
end if

If dw_1.Update() <> 1 Then
Rollback using sqlca;
Return
End If

Commit Using sqlca;
MessageBox('Data Lengkap','Simpan Data Sukses')

note : for messagebox used BAHASA INDONESIA
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top