Starts in:
0 DAY
19 HRS
30 MIN
1 SEC
Starts in:
0 D
19 H
30 M
1 S
Open Closed

I need to change my system's UTC to match my region's UTC #1633


User avatar
0
sunivycsm created

I need to change my system's UTC to match my region's UTC?

If you're creating a bug/problem report, please include followings:

  • ABP Framework version: vX.X.X

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

    Hi,

    Can you explain in detail?

  • User Avatar
    0
    sunivycsm created

    Hi liangshiwei I am using lock user on New User function. I'm at UTC +7, but when I login wrong and the account is locked, the time in the database is +00. How can I save as UTC +7 for our exact location

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    See: https://docs.abp.io/en/abp/latest/Timing

    Configure<AbpClockOptions>(options =>
    {
        options.Kind = DateTimeKind.Local;
    });
    
  • User Avatar
    0
    murat.yuceer created

    Hi,

    See: https://docs.abp.io/en/abp/latest/Timing

    Configure<AbpClockOptions>(options => 
    { 
        options.Kind = DateTimeKind.Local; 
    }); 
    

    Hi, liangshiwei i think abp always store UTC +0 on database right? But client side we need to store setting about client UTC. Where do we set this

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    This is the design of the Aspnet Core Identity, I would like to suggest that don't change it if you don't have to

    However, you can change it:

    [Dependency(ReplaceServices = true)]
    [ExposeServices(typeof(IdentityUserManager))]
    public class MyUserManager : IdentityUserManager
    {
        public MyUserManager(
            IdentityUserStore store,
            IIdentityRoleRepository roleRepository,
            IIdentityUserRepository userRepository,
            IOptions<IdentityOptions> optionsAccessor,
            IPasswordHasher<IdentityUser> passwordHasher,
            IEnumerable<IUserValidator<IdentityUser>> userValidators,
            IEnumerable<IPasswordValidator<IdentityUser>> passwordValidators,
            ILookupNormalizer keyNormalizer,
            IdentityErrorDescriber errors,
            IServiceProvider services,
            ILogger<IdentityUserManager> logger,
            ICancellationTokenProvider cancellationTokenProvider,
            IOrganizationUnitRepository organizationUnitRepository,
            ISettingProvider settingProvider) :
            base(store,
                roleRepository,
                userRepository,
                optionsAccessor,
                passwordHasher,
                userValidators,
                passwordValidators,
                keyNormalizer,
                errors,
                services,
                logger,
                cancellationTokenProvider,
                organizationUnitRepository,
                settingProvider)
        {
        }
    
        public override async Task<IdentityResult> AccessFailedAsync(IdentityUser user)
        {
            ThrowIfDisposed();
            var store = GetUserLockoutStore();
            if (user == null)
            {
                throw new ArgumentNullException(nameof(user));
            }
    
            // If this puts the user over the threshold for lockout, lock them out and reset the access failed count
            var count = await store.IncrementAccessFailedCountAsync(user, CancellationToken);
            if (count < Options.Lockout.MaxFailedAccessAttempts)
            {
                return await UpdateUserAsync(user);
            }
            Logger.LogWarning(12, "User is locked out.");
            await store.SetLockoutEndDateAsync(user, DateTime.Now.Add(Options.Lockout.DefaultLockoutTimeSpan),
                CancellationToken);
            await store.ResetAccessFailedCountAsync(user, CancellationToken);
            return await UpdateUserAsync(user);
        }
    
        public override async Task<bool> IsLockedOutAsync(IdentityUser user)
        {
            ThrowIfDisposed();
            var store = GetUserLockoutStore();
            if (user == null)
            {
                throw new ArgumentNullException(nameof(user));
            }
            if (!await store.GetLockoutEnabledAsync(user, CancellationToken))
            {
                return false;
            }
            var lockoutTime = await store.GetLockoutEndDateAsync(user, CancellationToken);
            return lockoutTime >= DateTime.Now;
        }
    
        private IUserLockoutStore<IdentityUser> GetUserLockoutStore()
        {
            var cast = Store as IUserLockoutStore<IdentityUser>;
            return cast;
        }
    }
    
  • User Avatar
    0
    ServiceBot created
    Support Team Automatic process manager

    This question has been automatically marked as stale because it has not had recent activity.

Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06