Sign in to follow this  
Followers 0
bucky002

Help Making A Login Form

11 posts in this topic

#1 ·  Posted (edited)

How do I make it so that it will make sure that what I typed in is my username and password? You can give me what to look for in the help files if you want. And how do I make it so my pass characters will come up like this

"*"? I know how to do it using this

InputBox( "Login", "password", "", "*", 50, 50, 50, 50,0)
, but I Don't know how to do it in a GUI. Also where can I store the passwords and stuff without anyone being able to open and see them? Like can I store it in an .ini file or something like that? I also might need help on making a registration form, like where they will follow the instructions by making a username password etc. then it will save it somewhere. And when they loging it will search that file for the username and password to see if they entered it correctly.

This is the little GUI I made.

#region --- GuiBuilder code Start ---
; Script generated by AutoBuilder 0.6 Prototype

#include <GuiConstants.au3>

GuiCreate("Login", 342, 126,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Group_1 = GuiCtrlCreateGroup("Username", 10, 10, 200, 50)
$Input_2 = GuiCtrlCreateInput("", 20, 30, 180, 20)
$Input_3 = GuiCtrlCreateInput("", 20, 90, 180, 20)
$Group_4 = GuiCtrlCreateGroup("Password", 10, 70, 200, 50)
$Button_5 = GuiCtrlCreateButton("Login", 230, 50, 80, 30)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
    ;;;
    EndSelect
WEnd
Exit
#endregion --- GuiBuilder generated code End ---
Edited by bucky002

Share this post


Link to post
Share on other sites



try

#region --- GuiBuilder code Start ---
; Script generated by AutoBuilder 0.6 Prototype

#include <GuiConstants.au3>

GuiCreate("Login", 342, 126,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Group_1 = GuiCtrlCreateGroup("Username", 10, 10, 200, 50)
$Input_2 = GuiCtrlCreateInput("", 20, 30, 180, 20)
$Input_3 = GuiCtrlCreateInput("", 20, 90, 180, 20,$ES_PASSWORD)
$Group_4 = GuiCtrlCreateGroup("Password", 10, 70, 200, 50)
$Button_5 = GuiCtrlCreateButton("Login", 230, 50, 80, 30)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
   ;;;
    EndSelect
WEnd
Exit
#endregion --- GuiBuilder generated code End ---


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

Thanks bigdod.

Can anyone help me with my other questions?

Share this post


Link to post
Share on other sites

Thanks bigdod.

Can anyone help me with my other questions?

I stored a Password in an ini-file in on of my programs. Thats quiete easy to access, but surely you have to apply an encryption function to it.

Also this might not be a good solution for you because of multiple users. Maybe there you can play with arrays, defining something like $user[$name] = ... $user[$password] = ..(encrypted password.. . Before writing new you have to x-check if this combination already exists.

Or I saw a script snippet around the board about "filewritecertainline" or something. Writing a concatonated string like (1|username|password) should also work, but never forget to apply an encryption function :)...


This post will be edited again by Polyphem: Tomorrow, 11:55 AM

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I'm sorta new to this. So how do I make an .ini file readable? like if i'd do this

Iniwrite("C:\Documents and Settings\Christian\Desktop\Crap Folder\username.ini", "bucky002", "", "")
how do I make it so if I'd make I did something like this
$username = InputBox('username', 'Username', "", "", 50,50,50,50)
$password = InputBox("Password", "Password", "","*",50,50,50,50)
IniRead("C:\Documents and Settings\Christian\Desktop\Crap Folder\username.ini", "bucky002", "", "")

It would verify whether that is the correct username and if it is it'll run notepad or something?

Edited by bucky002

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I fear it's not easy to answer (without a full tutorial) and you have to do some further reading, as it involves (depending on your level of experience) at least some hour work (expert 10min - open end, I guess I could do it in an hour or two).

You need:

Guis

- Register (how do you want to restrict registration)

- Login (read input, read password-file, compare and sent either to error or your restricted area)

Functions

- Read File (from Register for addition and Login for validation)

- Write File (from Register)

- Encrypt Password

A concept on how to read/write file. Depends on what information/how many fields you want to store (see my post above). The best point to start would be the boards search-function :), maybe anyone already has solved all your problems.

Edited by Polyphem

This post will be edited again by Polyphem: Tomorrow, 11:55 AM

Share this post


Link to post
Share on other sites

Ok, Thanks for the help. :)

Share this post


Link to post
Share on other sites

This should cover it if you are having a single or mulitple users using 1 computer

#include <guiconstants.au3>
VERIFYUSER()

Func VERIFYUSER()
    Local $FILEPATHTOINI = @DesktopDir & '\TEST.INI'; CHANGE THIS TO THE PATH OF YOUR INI
    $VERIFYGUI = GUICreate('Username - Password Validation', 210, 145)
    GUICtrlCreateLabel('USERNAME', 10, 10)
    $USERNAME = GUICtrlCreateInput('', 10, 30, 190, 20)
    GUICtrlCreateLabel('PASSWORD', 10, 60)
    $PASSWORD = GUICtrlCreateInput('', 10, 80, 190, 20, $ES_PASSWORD)
    $SUBMIT = GUICtrlCreateButton('SUBMIT', 75, 110, 50, 30)
    GUISetState()

    While 1
        $MSG = GUIGetMsg()
        Select
            Case $MSG = $GUI_EVENT_CLOSE
                Exit
            Case $MSG = $SUBMIT
                $READUSERNAME = GUICtrlRead($USERNAME)
                $READPASSWORD = GUICtrlRead($PASSWORD)
                If $READUSERNAME <> '' And $READPASSWORD <> '' Then
                    $CHECKUP = CHECKUSERNAMEPASSWORD($READUSERNAME, $READPASSWORD, $FILEPATHTOINI)
                    If $CHECKUP == 0 Then
                        If MsgBox(68, 'INFO:', 'WE DO NOT SEEM TO HAVE YOUR USERNAME AND PASSWORD ON FILE?' _ 
                        & @CR & 'WOULD YOU LIKE TO USE THIS INFO YOU HAVE PROVIDED TO CREATE ONE?') == 6 Then
                        CREATEUSERNAMEPASSWORD($READUSERNAME, $READPASSWORD, $FILEPATHTOINI)
                        EndIf
                    ElseIf $CHECKUP == 1 Then
                        MsgBox(64, 'SUCCESS', 'YOU HAVE BEEN LOGGED IN')
                        ExitLoop
                    EndIf
                Else
                    MsgBox(64, 'ERROR', 'YOU DID NOT FILL IN EITHER THE USERNAME OR PASSWORD.')
                EndIf
        EndSelect
    WEnd
    GUIDelete($VERIFYGUI)
EndFunc

Func CHECKUSERNAMEPASSWORD($v_USERNAME, $v_PASSWORD, $h_FILEPATH)
    Local $INISECTION = IniReadSection($h_FILEPATH, 'UsernamePassword')
    Local $FOUND = 0
    If Not $INISECTION[0][0] >= 1 Then Return 0
    For $iINIREAD = 1 To $INISECTION[0][0]
        If StringInStr($INISECTION[$iINIREAD][0], $v_USERNAME) And StringInStr($INISECTION[$iINIREAD][1], $v_PASSWORD) Then
            $FOUND = 1
            ExitLoop
        EndIf
    Next
    If $FOUND = 1 Then Return 1
EndFunc

Func CREATEUSERNAMEPASSWORD($v_USERNAME, $v_PASSWORD, $h_FILEPATH)
    IniWrite($h_FILEPATH, 'UsernamePassword', $v_USERNAME, $v_PASSWORD)
EndFunc

Example INI =

[usernamePassword]smoke_n=123

Hope it get's you started...

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

My email inbox got a special offer with a weblink to my bank. Pity the underlying address was a fake.

Are you trying to set up a phishing scam to collect logins and passwords?

People get very resentful if you store their personal information such as passwords in an easily decodable format, so make sure any storage of data you collect cannot be easily decoded. Human nature being what it is, a lot of people will use the same password across a number of packages, both at work and home, so if your software is the weakest link, then all the other security in place for everything else is useless.

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

I'm just using it as like...well here's an example. Say I open notepad, notepad will close and ask my information if it doesn't match then it will close, but if it does match notepad will open. Just stuff for my computer not for anyone else's. Plus I have no use for any of my siblings passwords. I know my parents, because I made their emails.

Thanks Smoke_N. :)

Edited by bucky002

Share this post


Link to post
Share on other sites

I got an error that said "If Not $INISECTION[0][0] >= 1 Then Return 0"

"If Not $INISECTION^ Error"

"Error: Subscript used with non-Array variable."

Any idea how I can fix that?

Thanks.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0