从代码创建 Dot Net Nuke 用户

发布于 2024-12-06 09:29:24 字数 185 浏览 1 评论 0原文

有人可以告诉我是否可以通过代码在 dotnetnuke 应用程序中创建新用户吗?我有一个希望通过 Windows 服务添加的用户列表。

我已经弄清楚如何编写 t-sql 方面的内容,但我需要将加密密码传递到程序中,我想我知道如何执行此操作,因为我可以访问机器密钥,但在数据库中是一个名为“passwordsalt”的额外字段,我如何生成它?

Can someone please tell me if it possible to create a new user in a dotnetnuke application from code? I have a list of users that I wish to be added via a windows service.

I've figured out how to write the t-sql side of things but I need to pass in the encrypted password into the procedure, I think I know how to do this as I have access to the machine key, but in the database there is an extra field called passwordsalt, how do I generate this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

向日葵 2024-12-13 09:29:24

UserController 类具有静态方法:

CreateUser(ByRef objUser As UserInfo) As UserCreateStatus

GeneratePassword() As String

ChangePassword(ByVal user As UserInfo, 
               ByVal oldPassword As String, 
               ByVal newPassword As String) As Boolean

在调用 CreateUser 之前,您需要创建一个 UserInfo 对象并设置用户所需的属性,例如作为用户名。 UserController 将 UserInfo 传递给成员资格提供者,后者验证并创建用户。有关更多详细信息,请参阅 DNN 源代码中的 UserControllerAspNetMembershipProvider

UserController class has static methods:

CreateUser(ByRef objUser As UserInfo) As UserCreateStatus

GeneratePassword() As String

ChangePassword(ByVal user As UserInfo, 
               ByVal oldPassword As String, 
               ByVal newPassword As String) As Boolean

Before calling CreateUser, you'll need to create a UserInfo object and set the properties required for a user, such as the Username. UserController passes the UserInfo to the membership provider, which validates and creates the user. See UserController and AspNetMembershipProvider in the DNN source for more details.

一袭水袖舞倾城 2024-12-13 09:29:24

有人可以告诉我是否可以在
代码中的 dotnetnuke 应用程序?

如果不可能,那么 dotnetnuke 本身就无法创建用户。查看 DotNetNuke 的代码并了解如何创建用户。

我已经弄清楚如何编写 t-sql 方面的内容,但我需要
将加密的密码传递到程序中,我想我知道怎么做
这样做是因为我可以访问机器密钥,但在数据库中
有一个名为“passwordsalt”的额外字段,如何生成它?

帮自己一个忙,不要运行自己的 t-sql 查询,而是使用创建用户的方法。

Can someone please tell me if it possible to create a new user in a
dotnetnuke application from code?

If it wasn't possible then dotnetnuke itself couldn't create a user. Look at the code for DotNetNuke and see how a user is created.

I've figured out how to write the t-sql side of things but I need to
pass in the encrypted password into the procedure, I think I know how
to do this as I have access to the machine key, but in the database
there is an extra field called passwordsalt, how do I generate this?

Do yourself a favor and do NOT run your own t-sql query use the method that creates a user instead.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文