#1 2025-09-09 12:32:20

lfyey121
Member
From: china
Registered: 2022-08-25
Posts: 77

TAuthUser.ComputeHashedPassword changed

I previously used the TAuthUser.ComputeHashedPassword changed to set the default password, but now this method has changed from public to protected, which makes it impossible to set the default password. Could you please suggest a solution?


  AuthAdminDefaultPassword:=TAuthUser.ComputeHashedPassword('Admin',setting.AdminDefaultPwd);

Offline

#2 2025-09-09 12:48:48

lfyey121
Member
From: china
Registered: 2022-08-25
Posts: 77

Re: TAuthUser.ComputeHashedPassword changed

I inherited a subclass from TauthUser, and then made the computeHashedPassword method public, which solved the problem.

Offline

#3 2025-09-09 19:32:28

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 15,181
Website

Re: TAuthUser.ComputeHashedPassword changed

Why would you use this method?
There are the SetPassword/SetPasswordDigest methods to set the password according to the expected scheme.

Offline

#4 2025-09-11 09:05:11

lfyey121
Member
From: china
Registered: 2022-08-25
Posts: 77

Re: TAuthUser.ComputeHashedPassword changed

In order to initialize the global variable: AuthAdminDefaultPassword, set the initial password before calling the createMissingTable function.

Offline

#5 2025-09-11 19:52:51

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 15,181
Website

Re: TAuthUser.ComputeHashedPassword changed

I forgot about this usage - which is IMHO unsafe: you should better override the TAuthGroup.InitializeTable() method, for any serious work.

I have made it public again.
https://github.com/synopse/mORMot2/commit/1658da7d1

Offline

#6 2025-09-12 01:11:44

lfyey121
Member
From: china
Registered: 2022-08-25
Posts: 77

Re: TAuthUser.ComputeHashedPassword changed

Thank you for your work

Offline

Board footer

Powered by FluxBB