Open Closed

Password Settings does not works well #3345


User avatar
0
yasin.hallak.89@gmail.com created
  • ABP Framework version: v5.0.0
  • UI type: MVC
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no

hello there ..

I choosed only "Require Digit"

when I add user and set password only digit from new uesr as like figure below :

it works well ..

but when I add user and set password only digit from here :

it not work and give me three errors :

  1. non-alphanumeric character
  2. Required lower case character
  3. Required upper case character

can I have solution for this problem

thank ...


12 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    I will check it.

  • User Avatar
    0
    yasin.hallak.89@gmail.com created

    Hi,

    I will check it.

    Ok .. I am waiting you

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    We had this problem on 5.3.0, it was fixed in 5.3.1, can you upgrade to 5.3.1 and try again?

  • User Avatar
    0
    yasin.hallak.89@gmail.com created

    Hi,

    We had this problem on 5.3.0, it was fixed in 5.3.1, can you upgrade to 5.3.1 and try again?

    Sorry Now I use V5.0.0 Not V5.3.0 ... Can you give me principled solution for now because I use Multi Module for bussinses .and I must to upgrade all of them

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Sorry, my bad, I thought you were using version 5.3.0, let me check it.

  • User Avatar
    0
    yasin.hallak.89@gmail.com created

    Sorry, my bad, I thought you were using version 5.3.0, let me check it.

    I am sorry my bad ..not your bad ... I was writing V 5.3.0

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    I could not reproduce the problem

    Can you provide steps that I can reproduce the problem? thanks.

  • User Avatar
    0
    yasin.hallak.89@gmail.com created

    I could not reproduce the problem

    Can you provide steps that I can reproduce the problem? thanks.

    I wrote above steps for my problem .. I need to create user from code and set passwrod only digit as figure above

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    I wrote above steps for my problem ..

    https://support.abp.io/QA/Questions/3345#answer-163eaa79-9777-cdc7-722c-3a04c5a23f8d

    Or, can you use the suite to create a new project to reproduce the problem and share it with me? shiwei.liang@volosoft.com

  • User Avatar
    0
    yasin.hallak.89@gmail.com created

    I will repeat reproduce my problem

    I want to create user and take Id and use it in my entity Employee as below :

    public virtual async Task<EmployeeDto> CreateAsync(EmployeeCreateDto input)
    {
       
        var email = input.Email ?? $"{input.IdentityNo}@gmail.com";
    
        var user = new IdentityUser(Guid.NewGuid(), input.IdentityNo, email, CurrentTenant.Id);
        user.Surname = input.Name;
        var result = await _userManager.CreateAsync(user, "123456");
        if (!result.Succeeded)
        {
            throw new UserFriendlyException(@L["Validation:ErrorInServer"]);
        }
    
        var employee = ObjectMapper.Map<EmployeeCreateDto, Employee>(input);
        employee.TenantId = CurrentTenant.Id;
        employee.AppUserId = user.Id;
        employee.BirthDate = input.BirthDate.ToDate().Value;
        employee.IdentityDate=input.IdentityDate.ToDate().Value;    
        employee = await _employeeRepository.InsertAsync(employee, autoSave: true);
        return ObjectMapper.Map<Employee, EmployeeDto>(employee);
    }
    

    I set password digit only and set in password setting "Required Digit Only " as below :

    it does not work and give me error as below :

    I hope to be reproduce my problem well .. thanks

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Can you try this:

    protected IOptions<IdentityOptions> IdentityOptions { get; }
    
    public xxx(IOptions<IdentityOptions> identityOptions)
    {
       IdentityOptions = identityOptions;
    }
    
    public virtual async Task CreateAsync(EmployeeCreateDto input)
    {
        await IdentityOptions.SetAsync(); // this line
       
        var email = input.Email ?? $"{input.IdentityNo}@gmail.com";
    
        var user = new IdentityUser(Guid.NewGuid(), input.IdentityNo, email, CurrentTenant.Id);
        user.Surname = input.Name;
        var result = await _userManager.CreateAsync(user, "123456");
        if (!result.Succeeded)
        {
            throw new UserFriendlyException(@L["Validation:ErrorInServer"]);
        }
    
        var employee = ObjectMapper.Map(input);
        employee.TenantId = CurrentTenant.Id;
        employee.AppUserId = user.Id;
        employee.BirthDate = input.BirthDate.ToDate().Value;
        employee.IdentityDate=input.IdentityDate.ToDate().Value;    
        employee = await _employeeRepository.InsertAsync(employee, autoSave: true);
        return ObjectMapper.Map(employee);
    }
    
  • User Avatar
    0
    yasin.hallak.89@gmail.com created

    Hi,

    Can you try this:

    protected IOptions<IdentityOptions> IdentityOptions { get; } 
     
    public xxx(IOptions<IdentityOptions> identityOptions) 
    { 
       IdentityOptions = identityOptions; 
    } 
     
    public virtual async Task CreateAsync(EmployeeCreateDto input) 
    { 
        await IdentityOptions.SetAsync(); // this line 
        
        var email = input.Email ?? $"{input.IdentityNo}@gmail.com"; 
     
        var user = new IdentityUser(Guid.NewGuid(), input.IdentityNo, email, CurrentTenant.Id); 
        user.Surname = input.Name; 
        var result = await _userManager.CreateAsync(user, "123456"); 
        if (!result.Succeeded) 
        { 
            throw new UserFriendlyException(@L["Validation:ErrorInServer"]); 
        } 
     
        var employee = ObjectMapper.Map(input); 
        employee.TenantId = CurrentTenant.Id; 
        employee.AppUserId = user.Id; 
        employee.BirthDate = input.BirthDate.ToDate().Value; 
        employee.IdentityDate=input.IdentityDate.ToDate().Value;     
        employee = await _employeeRepository.InsertAsync(employee, autoSave: true); 
        return ObjectMapper.Map(employee); 
    } 
    

    thank a lot it works well ...

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11