dnn 自定义登录页面后 跳转到登录页面会报错
使用自定义的登录模块出现的问题
页面的错误是:
You have been redirected to this default Login Page because the Login Page set for this website does not contain a valid DotNetNuke Account Login module, or the permissions have not been set correctly.
具体问题描述可参考: http://support.dotnetnuke.com/issue/ViewIssue.aspx?ID=10367&PROJID=2
Correct, here is the cuplrit called by Globals.LoginUrl (also located in Globals.vb) for your custom login tabid.
Public Function ValidateLoginTabID(ByVal tabId As Integer) As Boolean
Dim hasAccountModule As Boolean = Null.NullBoolean
For Each objModule As ModuleInfo In New ModuleController().GetTabModules(tabId).Values
If objModule.ModuleDefinition.FriendlyName = "Account Login" Then
hasAccountModule = True
Exit For
End If
Next
Return hasAccountModule
End Function
As you can see if your modules FriendlyName is not "Account Login" then it will default redirection to the current tab, using the default DNN login control. A simple fix is to just place the default "Account Login" module on the page and set the security to admin only. This will pass this check and redirect to the page
Public Function ValidateLoginTabID(ByVal tabId As Integer) As Boolean
Dim hasAccountModule As Boolean = Null.NullBoolean
For Each objModule As ModuleInfo In New ModuleController().GetTabModules(tabId).Values
If objModule.ModuleDefinition.FriendlyName = "Account Login" Then
hasAccountModule = True
Exit For
End If
Next
Return hasAccountModule
End Function
As you can see if your modules FriendlyName is not "Account Login" then it will default redirection to the current tab, using the default DNN login control. A simple fix is to just place the default "Account Login" module on the page and set the security to admin only. This will pass this check and redirect to the page
实际使用中我们只需要修改模块定义的别名。
1.首先修改默认登录模块“Authentication”的模块定义“Account Login”为“Account Login2”。
2.修改自定义登录模块的模块定义名称为“Account Login”。
这样修改后就正常了。