Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

How to match password? #9025


User avatar
0
huntethan89 created

Hi am building one Winforms application (Separate from abp zero solution) which uses exact copy of database present in my web application. We have created mechanism to sync data between desktop app and web app (ABP Zero based). This is because mostly desktop app will work offline.

My question is: Is there any way I can match user password on my Desktop application using your DLL’s.

I have imported abp zero DLL’s into my desktop application in order to use this method:

var loginResult = await _logInManager.LoginAsync(userID, txtPassword.Text, "Default");

But I am stuck when I am calling form from Program.cs file.

Here is my Login form:

public partial class Login : Form { private readonly LogInManager _logInManager; public Login(LogInManager logInManager) { _logInManager = logInManager; InitializeComponent(); }

How to call this from program.cs... I am trying to open Login form as startup:

` public class Program { private readonly LogInManager _logInManager; public Program(LogInManager logInManager) { _logInManager = logInManager; }

    /// <summary>
    /// The main entry point for the application.
    /// </summary>
    [STAThread]
    static void Main()
    {
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
    //------- THis line is not working as this is static class
        Application.Run(new Login(_logInManager));
    }

    

}`

This line is giving me error: Application.Run(new Login(_logInManager));

OR is there any method we can use ABP Zero DLL's to match passwords offile?


2 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    You can use IPasswordHasher<User> to hash the entered password and then you can compare it with the value in your database.

  • User Avatar
    0
    huntethan89 created

    Thanks a lot.

    Here is my Final Code:

      PasswordHasher pwd = new PasswordHasher();
      var password_Hast_To_Verify = "ABLLEjWGN2lTfbNdttIBLgu1hEYilCX06CQ9NdejQUsfdrlJZl8f0I9gWbfUGQUFUA==";
      var result = pwd.VerifyHashedPassword(password_Hast_To_Verify, "123qwe");