Fixes the user password validation to ensure it obeys what the membership provider's are configured for.
This commit is contained in:
@@ -1,4 +1,15 @@
|
||||
angular.module("umbraco.install").controller("Umbraco.Install.UserController", function($scope, installerService){
|
||||
angular.module("umbraco.install").controller("Umbraco.Install.UserController", function($scope, installerService) {
|
||||
|
||||
$scope.passwordPattern = /.*/;
|
||||
if ($scope.installer.current.model.minNonAlphaNumericLength > 0) {
|
||||
var exp = "";
|
||||
for (var i = 0; i < $scope.installer.current.model.minNonAlphaNumericLength; i++) {
|
||||
exp += ".*[\\W].*";
|
||||
}
|
||||
//replace duplicates
|
||||
exp = exp.replace(".*.*", ".*");
|
||||
$scope.passwordPattern = new RegExp(exp);
|
||||
}
|
||||
|
||||
$scope.validateAndInstall = function(){
|
||||
installerService.install();
|
||||
|
||||
@@ -27,8 +27,15 @@
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="password">Password</label>
|
||||
<div class="controls">
|
||||
<input type="password" name="installer.current.model.password" ng-minlength="8" required ng-model="installer.current.model.password" />
|
||||
<small class="inline-help">Atleast 8 characters long</small>
|
||||
<input type="password" name="installer.current.model.password"
|
||||
ng-minlength="{{installer.current.model.minCharLength}}"
|
||||
ng-pattern="passwordPattern"
|
||||
required
|
||||
ng-model="installer.current.model.password" />
|
||||
<small class="inline-help">At least {{installer.current.model.minCharLength}} characters long</small>
|
||||
<small ng-if="installer.current.model.minNonAlphaNumericLength > 0" class="inline-help">
|
||||
At least {{installer.current.model.minNonAlphaNumericLength}} symbol{{installer.current.model.minNonAlphaNumericLength > 1 ? 's' : ''}}
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -72,10 +72,25 @@ namespace Umbraco.Web.Install.InstallSteps
|
||||
admin.Username = user.Email.Trim();
|
||||
|
||||
_applicationContext.Services.UserService.Save(admin);
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return a custom view model for this step
|
||||
/// </summary>
|
||||
public override object ViewModel
|
||||
{
|
||||
get
|
||||
{
|
||||
return new
|
||||
{
|
||||
minCharLength = Membership.Providers[Constants.Conventions.User.UmbracoUsersProviderName].MinRequiredPasswordLength,
|
||||
minNonAlphaNumericLength = Membership.Providers[Constants.Conventions.User.UmbracoUsersProviderName].MinRequiredNonAlphanumericCharacters
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public override string View
|
||||
{
|
||||
get { return RequiresExecution(null)
|
||||
|
||||
@@ -57,6 +57,12 @@ namespace Umbraco.Web.Install.Models
|
||||
[DataMember(Name = "view")]
|
||||
public virtual string View { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The view model used to render the view, by default is null but can be populated
|
||||
/// </summary>
|
||||
[DataMember(Name = "model")]
|
||||
public virtual object ViewModel { get; private set; }
|
||||
|
||||
[DataMember(Name = "description")]
|
||||
public string Description { get; private set; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user