AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

check username/password

Ein Thema von question · begonnen am 28. Okt 2013 · letzter Beitrag vom 31. Okt 2013
Antwort Antwort
question

Registriert seit: 17. Apr 2013
97 Beiträge
 
#1

check username/password

  Alt 28. Okt 2013, 09:01
hi,
I have a table called "userdata" which contains (username, password)
I have a window in Delphi with two edit fields username and password and one button "Login"
After typing username and password, when I click on "Login" button, I would like to check whether username and password is match or not
I have tried with following code but it is not working
Code:
procedure TForm1.Checkuserdata(Sender: TObject);
begin
  Table.Open;
  Table.First;
  while not Table.Eof do begin
    if (Edit1.Text = Table.FieldByName('username').AsString) and
   (Edit2.Text = Table.FieldByName('password').AsString)
   then
       Showmessage('match the user data');
       exit;
    end;
  Mit Zitat antworten Zitat
Benutzerbild von FBrust
FBrust

Registriert seit: 4. Okt 2002
Ort: Saarbrücken
654 Beiträge
 
Delphi 10.4 Sydney
 
#2

AW: check username/password

  Alt 28. Okt 2013, 09:15
Hello,

in your while-loop, you should place a "Table.Next":

Delphi-Quellcode:
procedure TForm1.Checkuserdata(Sender: TObject);
begin
  Table.Open;
  Table.First;
  while not Table.Eof do begin
    if (Edit1.Text = Table.FieldByName('username').AsString) and
       (Edit2.Text = Table.FieldByName('password').AsString)
    then begin
      Showmessage('match the user data');
      exit;
    end;
    Table.Next;
  end;
end;
"Ich habe Dinge gesehen, die ihr Menschen niemals glauben würdet. Gigantische Schiffe, die brannten, draußen vor der Schulter des Orion" - Roy Batty
  Mit Zitat antworten Zitat
generic

Registriert seit: 24. Mär 2004
Ort: bei Hannover
2.415 Beiträge
 
Delphi XE5 Professional
 
#3

AW: check username/password

  Alt 28. Okt 2013, 11:03
for security you never should store plain password's in databases.
use a hash function with salt, please.
Coding BOTT - Video Tutorials rund um das Programmieren - https://www.youtube.com/@codingbott
  Mit Zitat antworten Zitat
question

Registriert seit: 17. Apr 2013
97 Beiträge
 
#4

AW: check username/password

  Alt 28. Okt 2013, 12:47
for security you never should store plain password's in databases.
use a hash function with salt, please.
Thank you very much for your reply
currently, i am saving the plain text(Edit2.Text) as a password, how can i use hash function with salt
there is already a page about it http://www.delphipraxis.net/176994-s...eichern-2.html
but since my German skill is not that good, therefore, to have a small example would be kind of you
  Mit Zitat antworten Zitat
generic

Registriert seit: 24. Mär 2004
Ort: bei Hannover
2.415 Beiträge
 
Delphi XE5 Professional
 
#5

AW: check username/password

  Alt 31. Okt 2013, 13:33
for security you never should store plain password's in databases.
use a hash function with salt, please.
Thank you very much for your reply
currently, i am saving the plain text(Edit2.Text) as a password, how can i use hash function with salt
there is already a page about it http://www.delphipraxis.net/176994-s...eichern-2.html
but since my German skill is not that good, therefore, to have a small example would be kind of you
Try this: https://crackstation.net/hashing-security.htm
Coding BOTT - Video Tutorials rund um das Programmieren - https://www.youtube.com/@codingbott
  Mit Zitat antworten Zitat
Perlsau
(Gast)

n/a Beiträge
 
#6

AW: check username/password

  Alt 31. Okt 2013, 13:52
Why not working with locate?
Delphi-Quellcode:
if not Table.locate('username; passwort', VarArrayOf([Username, Password], []) then
   ShowMessage('Wrong user and password');
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 07:54 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz