Base solution for your next web application
Open Closed

Login Error When User Set To ShouldChangePasswordOnNextLogin #3523


User avatar
0
karimgarza created

Hi,

I am using the asp.net core / angular2 template

Upon the first login, I am getting an error when the user is set to ShouldChangePasswordOnNextLogin=true

Here is the log

INFO  2017-07-10 22:11:10,564 [3    ] ore.Mvc.Internal.ControllerActionInvoker - Executing action method Airforce.AFWIN.Web.Controllers.TokenAuthController.Authenticate (Airforce.AFWIN.Web.Core) with arguments (Airforce.AFWIN.Web.Models.TokenAuth.AuthenticateModel) - ModelState is Valid
DEBUG 2017-07-10 22:11:14,171 [3    ] ore.Mvc.Internal.ControllerActionInvoker - Executed action method Airforce.AFWIN.Web.Controllers.TokenAuthController.Authenticate (Airforce.AFWIN.Web.Core), returned result Microsoft.AspNetCore.Mvc.ObjectResult.
ERROR 2017-07-10 22:11:14,215 [3    ] Mvc.ExceptionHandling.AbpExceptionFilter - Database operation expected to affect 1 row(s) but actually affected 0 row(s). Data may have been modified or deleted since entities were loaded. See http://go.microsoft.com/fwlink/?LinkId=527962 for information on understanding and handling optimistic concurrency exceptions.
Abp.Domain.Uow.AbpDbConcurrencyException: Database operation expected to affect 1 row(s) but actually affected 0 row(s). Data may have been modified or deleted since entities were loaded. See http://go.microsoft.com/fwlink/?LinkId=527962 for information on understanding and handling optimistic concurrency exceptions. ---> Microsoft.EntityFrameworkCore.DbUpdateConcurrencyException: Database operation expected to affect 1 row(s) but actually affected 0 row(s). Data may have been modified or deleted since entities were loaded. See http://go.microsoft.com/fwlink/?LinkId=527962 for information on understanding and handling optimistic concurrency exceptions.
   at Microsoft.EntityFrameworkCore.Update.AffectedCountModificationCommandBatch.ThrowAggregateUpdateConcurrencyException(Int32 commandIndex, Int32 expectedRowsAffected, Int32 rowsAffected)
   at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection)
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.Execute(Tuple`2 parameters)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(IReadOnlyList`1 entriesToSave)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(Boolean acceptAllChangesOnSuccess)
   at Microsoft.EntityFrameworkCore.DbContext.SaveChanges(Boolean acceptAllChangesOnSuccess)
   at Abp.EntityFrameworkCore.AbpDbContext.SaveChanges()
   --- End of inner exception stack trace ---
   at Abp.EntityFrameworkCore.AbpDbContext.SaveChanges()
   at Abp.EntityFrameworkCore.Uow.EfCoreUnitOfWork.SaveChanges()
   at Abp.EntityFrameworkCore.Uow.EfCoreUnitOfWork.CompleteUow()
   at Abp.Domain.Uow.UnitOfWorkBase.Complete()
   at Abp.Domain.Uow.UnitOfWorkInterceptor.PerformSyncUow(IInvocation invocation, UnitOfWorkOptions options)
   at Castle.DynamicProxy.AbstractInvocation.Proceed()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Abp.Events.Bus.EventBus.Trigger(Type eventType, Object eventSource, IEventData eventData)
   at Abp.Events.Bus.EventBus.TriggerHandlingException(Type eventType, Object eventSource, IEventData eventData, List`1 exceptions)
   at Abp.Events.Bus.EventBus.Trigger(Type eventType, Object eventSource, IEventData eventData)
   at Abp.Events.Bus.EventBus.TriggerHandlingException(Type eventType, Object eventSource, IEventData eventData, List`1 exceptions)
   at Abp.Events.Bus.EventBus.Trigger(Type eventType, Object eventSource, IEventData eventData)
   at System.EventHandler.Invoke(Object sender, EventArgs e)
   at Abp.Domain.Uow.UnitOfWorkBase.OnCompleted()
   at Abp.Domain.Uow.UnitOfWorkBase.<CompleteAsync>d__56.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Abp.AspNetCore.Mvc.Uow.AbpUowActionFilter.<OnActionExecutionAsync>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextActionFilterAsync>d__25.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextExceptionFilterAsync>d__24.MoveNext()
DEBUG 2017-07-10 22:11:14,230 [3    ] ore.Mvc.Internal.ControllerActionInvoker - Request was short circuited at exception filter 'Abp.AspNetCore.Mvc.ExceptionHandling.AbpExceptionFilter'.
DEBUG 2017-07-10 22:11:14,230 [3    ] etCore.Mvc.Internal.ObjectResultExecutor - Could not find an output formatter based on content negotiation. Accepted types were (application/json; charset=UTF-8)
DEBUG 2017-07-10 22:11:14,230 [3    ] etCore.Mvc.Internal.ObjectResultExecutor - Selected output formatter 'Microsoft.AspNetCore.Mvc.Formatters.JsonOutputFormatter' and content type 'application/json' to write the response.
INFO  2017-07-10 22:11:14,230 [3    ] etCore.Mvc.Internal.ObjectResultExecutor - Executing ObjectResult, writing value Microsoft.AspNetCore.Mvc.ControllerContext.

Do you guys have any ideas on why this would be happening ?

Thank you,


1 Answer(s)
  • User Avatar
    0
    alper created
    Support Team

    Hi It's hard to find the database concurrency problem without reading the specified log. But there's a issue on github about UserManager. Can you check that <a class="postlink" href="https://github.com/aspnetboilerplate/module-zero/issues/376">https://github.com/aspnetboilerplate/mo ... issues/376</a>