Web App Gallery installer: validate mysql username length
This commit is contained in:
parent
9e9f3f7b62
commit
f208ce2522
3 changed files with 37 additions and 0 deletions
|
@ -52,6 +52,10 @@
|
||||||
<asp:RegularExpressionValidator ID="regexpTextValue" runat="server"
|
<asp:RegularExpressionValidator ID="regexpTextValue" runat="server"
|
||||||
ControlToValidate="textValue" Text="!" ValidationGroup="wag"
|
ControlToValidate="textValue" Text="!" ValidationGroup="wag"
|
||||||
Display="Dynamic" SetFocusOnError="True"></asp:RegularExpressionValidator>
|
Display="Dynamic" SetFocusOnError="True"></asp:RegularExpressionValidator>
|
||||||
|
<asp:CustomValidator runat="server" ID="MysqlUsernameLengthValidator"
|
||||||
|
ControlToValidate="textValue" OnServerValidate="mysqlUsernameLen_OnServerValidate"
|
||||||
|
Display="Dynamic" SetFocusOnError="True" ValidationGroup="wag" Enabled="False"
|
||||||
|
Text="Mysql username can not be longer than 16 characters"></asp:CustomValidator>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -213,6 +213,15 @@ namespace WebsitePanel.Portal
|
||||||
textValue.Text = DefaultValue;
|
textValue.Text = DefaultValue;
|
||||||
valPrefix.Text = ValuePrefix;
|
valPrefix.Text = ValuePrefix;
|
||||||
valSuffix.Text = ValueSuffix;
|
valSuffix.Text = ValueSuffix;
|
||||||
|
|
||||||
|
if (
|
||||||
|
(WellKnownTags & DeploymentParameterWellKnownTag.MySql) == DeploymentParameterWellKnownTag.MySql
|
||||||
|
&&
|
||||||
|
(WellKnownTags & DeploymentParameterWellKnownTag.DBUserName) == DeploymentParameterWellKnownTag.DBUserName
|
||||||
|
)
|
||||||
|
{
|
||||||
|
MysqlUsernameLengthValidator.Enabled = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -248,5 +257,20 @@ namespace WebsitePanel.Portal
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void mysqlUsernameLen_OnServerValidate(object source, ServerValidateEventArgs args)
|
||||||
|
{
|
||||||
|
args.IsValid = true;
|
||||||
|
|
||||||
|
// get entered database name with prefixes / suffixes
|
||||||
|
string value = GetParameterValue();
|
||||||
|
|
||||||
|
// check length
|
||||||
|
if (!string.IsNullOrEmpty(value) && value.Length <= 16)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// validation failed
|
||||||
|
args.IsValid = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -165,6 +165,15 @@ namespace WebsitePanel.Portal {
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
protected global::System.Web.UI.WebControls.RegularExpressionValidator regexpTextValue;
|
protected global::System.Web.UI.WebControls.RegularExpressionValidator regexpTextValue;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// MysqlUsernameLengthValidator control.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Auto-generated field.
|
||||||
|
/// To modify move field declaration from designer file to code-behind file.
|
||||||
|
/// </remarks>
|
||||||
|
protected global::System.Web.UI.WebControls.CustomValidator MysqlUsernameLengthValidator;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// BooleanControl control.
|
/// BooleanControl control.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue