Advanced safe login system
Heres your chance to share your own tutorials with the community. Just post them on here. If your lucky they may even be posted on the main site.
3 posts
Page 1 of 1
This tutorial will be about some safe login(as it should be).
Why it's safe? Answer: no textbox for password input. I think it should be safe
Lets start!
1)Add new form / or use existing.
2)Add 1 textbox, button, label and label for 'Username:' text if you need it.
Some debug labels out there... lmao;
3)Set KeyPreview option in form to True.
4)Time for coding...
Public variables:
listn - when to start capturing key presses.
pass(MAX_PASS_LENGTH) - array to store chars.
i - used to make string from array.
Next. Text for label: 'Click me to start saving pass' or something like that.
Code for mouse click on label:
Now on Form KeyPress event:
Finaly! On login button:
repass - string for changing array into string.
For ... - convert char in array to char in string, dropping if empty.
And that's about it. If you have any questions - ask here!
P.S.: I think you can add chars into string to check from the beginning
Why it's safe? Answer: no textbox for password input. I think it should be safe
Lets start!
1)Add new form / or use existing.
2)Add 1 textbox, button, label and label for 'Username:' text if you need it.
Some debug labels out there... lmao;
3)Set KeyPreview option in form to True.
4)Time for coding...
Public variables:
Code: Select all
Explain: Dim listn As Boolean = False
Dim pass(MAX_PASS_LENGTH) As String
Dim i As Integer = 0
listn - when to start capturing key presses.
pass(MAX_PASS_LENGTH) - array to store chars.
i - used to make string from array.
Next. Text for label: 'Click me to start saving pass' or something like that.
Code for mouse click on label:
Code: Select all
No need to explain here i think.If listn = False Then
TextBox1.Enabled = False
Label2.Text = "Listening to keys... Press me to stop(without save)."
Label4.Text = "Saved chars: " & i 'FOR DEBUG ONLY
Label2.Select()
listn = True
Else
TextBox1.Enabled = True
Label2.Text = "Click me to start saving pass"
Label4.Text = "Click label to start." ' FOR DEBUG ONLY
ReDim pass(MAX_PASS_LENGTH)
i = 0
listn = False
End If
Now on Form KeyPress event:
Code: Select all
Explain: Adding pressed char in place at array.If listn = True Then
If ass <= MAX_PASS_LENGTH Then
pass(i) = e.KeyValue
i += 1
Label4.Text = "Saved chars: " & i ' DEBUG
End If
End If
Finaly! On login button:
Code: Select all
Explain:Dim v As Integer
Dim repass As String = ""
For v = 0 To MAX_PASS_LENGTH
If pass(v) = "" Then
Else
repass = repass + ChrW(pass(v))
End If
Next
If TextBox1.Text = "USER_HERE" And repass.ToLower = "PASS_HERE" Then
MsgBox("Logined!") ' User logined.
End If
repass - string for changing array into string.
For ... - convert char in array to char in string, dropping if empty.
And that's about it. If you have any questions - ask here!
P.S.: I think you can add chars into string to check from the beginning
This is just as safe as a TextBox. With a TextBox you can set the UseSystemPasswordChar property (or something like that) which makes it unreadable, just as your code Nice work though cooll;
LMAOSHMSFOAIDMT
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;
Over 30 projects with source code!
Please give reputation to helpful members!
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;
Over 30 projects with source code!
Please give reputation to helpful members!
MrAksel wrote:This is just as safe as a TextBox. With a TextBox you can set the UseSystemPasswordChar property (or something like that) which makes it unreadable, just as your code Nice work though cooll;Maybe, it's safe because it not displays how many characters you typed in. Or, it will be just advanced
3 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023