diff --git a/App_LocalResources/Settings.ascx.resx b/App_LocalResources/Settings.ascx.resx index 532c99a..71f1c4b 100644 --- a/App_LocalResources/Settings.ascx.resx +++ b/App_LocalResources/Settings.ascx.resx @@ -210,4 +210,28 @@ Pending + + Enter the private key from your captcha account. (Get your key <a href="https://www.google.com/recaptcha/admin#whyrecaptcha" target="_blank">here</a>) + + + Private reCaptcha Key: + + + If checked, a check is being done if the firstname is not equal to the lastname. Note that you will have to setup your form template to include both fields! + + + Compare firstname with lastname: + + + Enter the regular expression for validating e-mail adresses + + + Regex Validation for E-Mail Adresses: + + + If checked, e-mail adresses will be verified against the regular expression below + + + Validate e-mail through Regex: + \ No newline at end of file diff --git a/App_LocalResources/Templates.ascx.resx b/App_LocalResources/Templates.ascx.resx index c48a48b..55ac078 100644 --- a/App_LocalResources/Templates.ascx.resx +++ b/App_LocalResources/Templates.ascx.resx @@ -132,7 +132,7 @@ Delete Selected - + Save Templates and Exit @@ -204,4 +204,7 @@ Template Locale: + + Save Templates + \ No newline at end of file diff --git a/App_LocalResources/View.ascx.resx b/App_LocalResources/View.ascx.resx index 3631256..5f9de73 100644 --- a/App_LocalResources/View.ascx.resx +++ b/App_LocalResources/View.ascx.resx @@ -315,4 +315,10 @@ The e-mail address needs to be verified + + The firstname and lastname may not be identical + + + + \ No newline at end of file diff --git a/Settings.ascx b/Settings.ascx index 3c4a968..e756145 100644 --- a/Settings.ascx +++ b/Settings.ascx @@ -61,4 +61,24 @@
+
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ +
\ No newline at end of file diff --git a/Settings.ascx.designer.vb b/Settings.ascx.designer.vb index 322d6d8..13522ef 100644 --- a/Settings.ascx.designer.vb +++ b/Settings.ascx.designer.vb @@ -175,5 +175,77 @@ Namespace Connect.Modules.UserManagement.AccountRegistration '''To modify move field declaration from designer file to code-behind file. ''' Protected WithEvents txtInterface As Global.System.Web.UI.WebControls.TextBox + + ''' + '''lblPrivateCaptchaKey control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblPrivateCaptchaKey As Global.DotNetNuke.UI.UserControls.LabelControl + + ''' + '''txtPrivateCaptchaKey control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtPrivateCaptchaKey As Global.System.Web.UI.WebControls.TextBox + + ''' + '''lblCompareFirstNameLastName control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblCompareFirstNameLastName As Global.DotNetNuke.UI.UserControls.LabelControl + + ''' + '''chkCompareFirstNameLastName control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkCompareFirstNameLastName As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''lblValidateEmailThroughRegex control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblValidateEmailThroughRegex As Global.DotNetNuke.UI.UserControls.LabelControl + + ''' + '''chkValidateEmailThroughRegex control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkValidateEmailThroughRegex As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''lblEmailRegex control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblEmailRegex As Global.DotNetNuke.UI.UserControls.LabelControl + + ''' + '''txtEmailRegex control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtEmailRegex As Global.System.Web.UI.WebControls.TextBox End Class End Namespace diff --git a/Settings.ascx.vb b/Settings.ascx.vb index 6467c5f..da8e4b8 100644 --- a/Settings.ascx.vb +++ b/Settings.ascx.vb @@ -3,6 +3,7 @@ Imports DotNetNuke Imports DotNetNuke.Services.Exceptions Imports DotNetNuke.Entities.Tabs Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Entities.Users Namespace Connect.Modules.UserManagement.AccountRegistration Partial Class Settings @@ -17,15 +18,26 @@ Namespace Connect.Modules.UserManagement.AccountRegistration BindPages() BindRoles() - If (Settings.Contains("ExternalInterface")) Then txtInterface.Text = Settings("ExternalInterface").ToString() - If (Settings.Contains("ShowUserName")) Then drpUsernameMode.SelectedValue = Settings("ShowUserName").ToString() - If (Settings.Contains("ShowDisplayName")) Then drpDisplaynameMode.SelectedValue = Settings("ShowDisplayName").ToString() - If (Settings.Contains("RedirectAfterSubmit")) Then drpRedirectAfterSubmit.SelectedValue = Settings("RedirectAfterSubmit").ToString() - If (Settings.Contains("UsermanagementTab")) Then drpUserManagementTab.SelectedValue = Settings("UsermanagementTab").ToString() - If (Settings.Contains("AddToRoleOnSubmit")) Then drpAddToRole.SelectedValue = Settings("AddToRoleOnSubmit").ToString() - If (Settings.Contains("NotifyRole")) Then drpNotifyRole.Items.FindByText(Settings("NotifyRole").ToString()).Selected = True - If (Settings.Contains("NotifyUser")) Then chkNotifyUser.Checked = CType(Settings("NotifyUser"), Boolean) - If (Settings.Contains("AddToRoleStatus")) Then drpRoleStatus.SelectedValue = CType(Settings("AddToRoleStatus"), String) + If (settings.Contains("ExternalInterface")) Then txtInterface.Text = settings("ExternalInterface").ToString() + If (settings.Contains("ShowUserName")) Then drpUsernameMode.SelectedValue = settings("ShowUserName").ToString() + If (settings.Contains("ShowDisplayName")) Then drpDisplaynameMode.SelectedValue = settings("ShowDisplayName").ToString() + If (settings.Contains("RedirectAfterSubmit")) Then drpRedirectAfterSubmit.SelectedValue = settings("RedirectAfterSubmit").ToString() + If (settings.Contains("UsermanagementTab")) Then drpUserManagementTab.SelectedValue = settings("UsermanagementTab").ToString() + If (settings.Contains("AddToRoleOnSubmit")) Then drpAddToRole.SelectedValue = settings("AddToRoleOnSubmit").ToString() + If (settings.Contains("NotifyRole")) Then drpNotifyRole.Items.FindByText(settings("NotifyRole").ToString()).Selected = True + If (settings.Contains("NotifyUser")) Then chkNotifyUser.Checked = CType(settings("NotifyUser"), Boolean) + If (settings.Contains("AddToRoleStatus")) Then drpRoleStatus.SelectedValue = CType(settings("AddToRoleStatus"), String) + If (settings.Contains("ReCaptchaKey")) Then txtPrivateCaptchaKey.Text = CType(settings("ReCaptchaKey"), String) + If (Settings.Contains("CompareFirstNameLastName")) Then chkCompareFirstNameLastName.Checked = CType(Settings("CompareFirstNameLastName"), Boolean) + If (Settings.Contains("ValidateEmailThroughRegex")) Then chkValidateEmailThroughRegex.Checked = CType(Settings("ValidateEmailThroughRegex"), Boolean) + If Settings.Contains("EmailRegex") Then + txtEmailRegex.Text = CType(Settings("EmailRegex"), String) + Else + Try + txtEmailRegex.Text = UserController.GetUserSettings(PortalId)("Security_EmailValidation") + Catch + End Try + End If End If Catch exc As Exception 'Module failed to load @@ -37,6 +49,7 @@ Namespace Connect.Modules.UserManagement.AccountRegistration Try Dim objModules As New Entities.Modules.ModuleController + objModules.UpdateTabModuleSetting(TabModuleId, "ReCaptchaKey", txtPrivateCaptchaKey.Text) objModules.UpdateTabModuleSetting(TabModuleId, "ExternalInterface", txtInterface.Text) objModules.UpdateTabModuleSetting(TabModuleId, "ShowUserName", drpUsernameMode.SelectedValue) objModules.UpdateTabModuleSetting(TabModuleId, "ShowDisplayName", drpDisplaynameMode.SelectedValue) @@ -47,6 +60,9 @@ Namespace Connect.Modules.UserManagement.AccountRegistration objModules.UpdateTabModuleSetting(TabModuleId, "NotifyRole", drpNotifyRole.SelectedItem.Text) objModules.UpdateTabModuleSetting(TabModuleId, "NotifyUser", chkNotifyUser.Checked.ToString) objModules.UpdateTabModuleSetting(TabModuleId, "AddToRoleStatus", drpRoleStatus.SelectedValue) + objModules.UpdateTabModuleSetting(TabModuleId, "CompareFirstNameLastName", chkCompareFirstNameLastName.Checked.ToString) + objModules.UpdateTabModuleSetting(TabModuleId, "ValidateEmailThroughRegex", chkValidateEmailThroughRegex.Checked.ToString) + objModules.UpdateTabModuleSetting(TabModuleId, "EmailRegex", txtEmailRegex.Text) Catch exc As Exception 'Module failed to load ProcessModuleLoadException(Me, exc) diff --git a/Templates.ascx b/Templates.ascx index b5e2ec6..ef79301 100644 --- a/Templates.ascx +++ b/Templates.ascx @@ -59,7 +59,8 @@ diff --git a/Templates.ascx.designer.vb b/Templates.ascx.designer.vb index 6c01e28..83daee0 100644 --- a/Templates.ascx.designer.vb +++ b/Templates.ascx.designer.vb @@ -222,13 +222,22 @@ Namespace Connect.Modules.UserManagement.AccountRegistration Protected WithEvents txtEmailAdminTemplate As Global.System.Web.UI.WebControls.TextBox ''' - '''cmdUpdateSettings control. + '''cmdUpdate control. ''' ''' '''Auto-generated field. '''To modify move field declaration from designer file to code-behind file. ''' - Protected WithEvents cmdUpdateSettings As Global.System.Web.UI.WebControls.LinkButton + Protected WithEvents cmdUpdate As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''cmdUpdateExit control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdUpdateExit As Global.System.Web.UI.WebControls.LinkButton ''' '''cmdCancel control. diff --git a/Templates.ascx.vb b/Templates.ascx.vb index d71612f..9e7f665 100644 --- a/Templates.ascx.vb +++ b/Templates.ascx.vb @@ -49,7 +49,7 @@ Namespace Connect.Modules.UserManagement.AccountRegistration BindSelectedTheme() End Sub - Private Sub cmdUpdateSettings_Click(sender As Object, e As System.EventArgs) Handles cmdUpdateSettings.Click + Private Sub cmdUpdate_Click(sender As Object, e As System.EventArgs) Handles cmdUpdate.Click Dim blnSucess As Boolean = False @@ -61,14 +61,26 @@ Namespace Connect.Modules.UserManagement.AccountRegistration End Sub - Private Sub cmdDeleteSelected_Click(sender As Object, e As System.EventArgs) Handles cmdDeleteSelected.Click + Private Sub cmdUpdateExit_Click(sender As Object, e As System.EventArgs) Handles cmdUpdateExit.Click + + Dim blnSucess As Boolean = False + + SaveTemplates(blnSucess) + If blnSucess Then + UpdateSettings() + End If + + Response.Redirect(NavigateURL()) + + End Sub + + Private Sub cmdDeleteSelected_Click(sender As Object, e As System.EventArgs) Handles cmdDeleteSelected.Click Try DeleteTheme() Catch ex As Exception DotNetNuke.UI.Skins.Skin.AddModuleMessage(Me, Localization.GetString("lblDeleteThemeError", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError) End Try - End Sub Private Sub cmdCancel_Click(sender As Object, e As System.EventArgs) Handles cmdCancel.Click @@ -100,7 +112,8 @@ Namespace Connect.Modules.UserManagement.AccountRegistration Private Sub LocalizeForm() cmdCancel.Text = Localization.GetString("cmdCancel", LocalResourceFile) - cmdUpdateSettings.Text = Localization.GetString("cmdUpdateSettings", LocalResourceFile) + cmdUpdateExit.Text = Localization.GetString("cmdUpdateExit", LocalResourceFile) + cmdUpdate.Text = Localization.GetString("cmdUpdate", LocalResourceFile) cmdCopySelected.Text = Localization.GetString("cmdCopySelected", LocalResourceFile) cmdDeleteSelected.Text = Localization.GetString("cmdDeleteSelected", LocalResourceFile) diff --git a/Templates/Default/Email.User.txt b/Templates/Default/Email.User.txt index c5aa963..7904a7b 100644 --- a/Templates/Default/Email.User.txt +++ b/Templates/Default/Email.User.txt @@ -25,208 +25,4 @@

[PORTALURL] -

- - -

Dear [DISPLAYNAME],

-

your user account on the website [PORTALNAME] has been created succesfully.

-

It is adviseable to keep your registration details in a safe place in case you need it one day.

- -

Details about your account

- - - - - - - - - - -
Username:[USERNAME]
Password:[PASSWORD]
E-Mail Adress:[EMAIL]
- -
- Click to manage Account -
- -

- Best wishes,
the team from [PORTALNAME] -

-

- [PORTALURL] -

- - -

Dear [DISPLAYNAME],

-

your user account on the website [PORTALNAME] has been created succesfully.

-

It is adviseable to keep your registration details in a safe place in case you need it one day.

- -

Details about your account

- - - - - - - - - - -
Username:[USERNAME]
Password:[PASSWORD]
E-Mail Adress:[EMAIL]
- -
- Click to manage Account -
- -

- Best wishes,
the team from [PORTALNAME] -

-

- [PORTALURL] -

- - -

Dear [DISPLAYNAME],

-

your user account on the website [PORTALNAME] has been created succesfully.

-

It is adviseable to keep your registration details in a safe place in case you need it one day.

- -

Details about your account

- - - - - - - - - - -
Username:[USERNAME]
Password:[PASSWORD]
E-Mail Adress:[EMAIL]
- -
- Click to manage Account -
- -

- Best wishes,
the team from [PORTALNAME] -

-

- [PORTALURL] -

- - -

Dear [DISPLAYNAME],

-

your user account on the website [PORTALNAME] has been created succesfully.

-

It is adviseable to keep your registration details in a safe place in case you need it one day.

- -

Details about your account

- - - - - - - - - - -
Username:[USERNAME]
Password:[PASSWORD]
E-Mail Adress:[EMAIL]
- -
- Click to manage Account -
- -

- Best wishes,
the team from [PORTALNAME] -

-

- [PORTALURL] -

- - -

Dear [DISPLAYNAME],

-

your user account on the website [PORTALNAME] has been created succesfully.

-

It is adviseable to keep your registration details in a safe place in case you need it one day.

- -

Details about your account

- - - - - - - - - - -
Username:[USERNAME]
Password:[PASSWORD]
E-Mail Adress:[EMAIL]
- -
- Click to manage Account -
- -

- Best wishes,
the team from [PORTALNAME] -

-

- [PORTALURL] -

- - -

Dear [DISPLAYNAME],

-

your user account on the website [PORTALNAME] has been created succesfully.

-

It is adviseable to keep your registration details in a safe place in case you need it one day.

- -

Details about your account

- - - - - - - - - - -
Username:[USERNAME]
Password:[PASSWORD]
E-Mail Adress:[EMAIL]
- -
- Click to manage Account -
- -

- Best wishes,
the team from [PORTALNAME] -

-

- [PORTALURL] -

- - -

Dear [DISPLAYNAME],

-

your user account on the website [PORTALNAME] has been created succesfully.

-

It is adviseable to keep your registration details in a safe place in case you need it one day.

- -

Details about your account

- - - - - - - - - - -
Username:[USERNAME]
Password:[PASSWORD]
E-Mail Adress:[EMAIL]
- -
- Click to manage Account -
- -

- Best wishes,
the team from [PORTALNAME] -

-

- [PORTALURL] -

- +

\ No newline at end of file diff --git a/Templates/Default/Form.txt b/Templates/Default/Form.txt index f52ad5f..16dfb7f 100644 --- a/Templates/Default/Form.txt +++ b/Templates/Default/Form.txt @@ -62,6 +62,9 @@ [CTL:ROLEMEMBERSHIP:Association Member:Pending] +
+ [RECAPTCHA:6LeT2vUSAAAAAK9YCM_6tQw3dbNUYnDVnEi4XEnQ] +
  • [CTL:UPDATEBUTTON:CreateAccount]
diff --git a/View.ascx.vb b/View.ascx.vb index ba43adf..0188839 100644 --- a/View.ascx.vb +++ b/View.ascx.vb @@ -9,6 +9,8 @@ Imports DotNetNuke Imports DotNetNuke.Services.Localization Imports DotNetNuke.Common.Globals Imports DotNetNuke.Common.Utilities +Imports System.Net +Imports System.IO Namespace Connect.Modules.UserManagement.AccountRegistration @@ -46,7 +48,49 @@ Namespace Connect.Modules.UserManagement.AccountRegistration End Sub Protected Sub btnUpdate_Click(ByVal sender As Object, ByVal e As System.EventArgs) - Register() + + Dim blnHasCaptchaControl As Boolean = False + Dim blnIsValid As Boolean = True + Dim strResultCode As String = "" + + Dim checkControl As Control = FindControlRecursive(plhRegister, plhRegister.ID & "_ReCaptchaPanel") + If Not checkControl Is Nothing Then + blnHasCaptchaControl = True + blnIsValid = False + End If + + If blnHasCaptchaControl Then + + ReCaptcha.Validate(ReCaptchaKey, blnIsValid, strResultCode) + + End If + + If blnIsValid Then + + Register() + + Else + + pnlError.Visible = True + pnlSuccess.Visible = False + Select Case strResultCode.ToLower + Case "invalid-site-private-key" + 'reCaptach set up not correct, register anyway. + Register() + Case "invalid-request-cookie" + lblError.Text = "The challenge solution was not correct" + Case "incorrect-captcha-sol" + lblError.Text = "The challenge solution was not correct" + Case "captcha-timeout" + lblError.Text = "You have waited too long for submitting the form" + Case "recaptcha-not-reachable" + 'reCaptach server not reachable. Register anyway. + Register() + Case Else + lblError.Text = "Unknown reCaptcha error." + End Select + End If + End Sub Protected Sub btnLogin_Click(ByVal sender As Object, ByVal e As System.EventArgs) @@ -212,7 +256,7 @@ Namespace Connect.Modules.UserManagement.AccountRegistration blnUpdateLastname = (Not txtLastName Is Nothing) - If (blnUpdateFirstname And blnUpdateLastname) Then + If CompareFirstNameLastName AndAlso (blnUpdateFirstname And blnUpdateLastname) Then If txtLastName.Text.ToLower.Trim = txtFirstName.Text.ToLower.Trim Then strMessages.Add("Error_LastnameLikeFirstname") AddErrorIndicator(Constants.User_Firstname, plhRegister)