Topic: Login and change password

I'm testing your program to login and change passwords. Fine program, but I discovered that when you want to change a password and bring in the current password and leave the new password(2x) "blanc" the programm accept this with the result that you cannot  login anymore for this user. Can you build in a check for "blanc" new passwords?

Re: Login and change password

Can please somebody help ?

Re: Login and change password

Check it out

procedure frmChangePassword_Button1_OnClick (Sender: string; var Cancel: boolean);
var
    s: string;
begin
    // SQL query for check user and password
    s := VarToStr( SQLExecute('SELECT count(id) FROM users WHERE (login = ''' + sUser + ''') AND (password = ' + frmChangePassword.edPassword.sqlValue + ');') );

    // if SQL query found login and password
    if (s <> '0') and (s<>'') then
    begin
        if (frmChangePassword.edNewPassword.Text<>'') and (frmChangePassword.edNewPassword.Text = frmChangePassword.edNewPassword2.Text) then
        begin
            // change password
            SQLExecute('UPDATE users SET password='+frmChangePassword.edNewPassword.sqlValue + ' WHERE login = ''' + sUser + '''');
            ShowMessage('Password has been changed.');
            frmChangePassword.Close;
        end else
            ShowMessage('Different passwords in text fields "New password" and "Repeat new password".');
    end else
        ShowMessage('Password is incorrent.');
end;


I just added check

 if (frmChangePassword.edNewPassword.Text<>'') and
Dmitry.

Re: Login and change password

Thanks Cor your reply, but is your answer complete, e.g. Is your check complete?

Re: Login and change password

akkerhof wrote:

Thanks Cor your reply, but is your answer complete, e.g. Is your check complete?

Unfortunately can't understand your question.

Dmitry.

Re: Login and change password

Sorry, I didn't read your built-in check not correctly. I tested and it works. Thanks

Re: Login and change password

I need CHANGE PASSWORD option too, please upload the sample.

Re: Login and change password

Ahmadrazaullah wrote:

I need CHANGE PASSWORD option too, please upload the sample.

Check it out
http://myvisualdatabase.com/forum/misc. … download=1

Dmitry.

Re: Login and change password

Thanks for giving me time.
cheers.