Base solution for your next web application

Activities of "affern"

Thanks, mate! :-)

Yes. I installed it with Yarn: yarn add owl.carousel jquery

Do you know how to set maxlength on the PrimeNG Editor?

Answer

<cite>aaron: </cite> Show code for your loop.

private void CreateVolumeTestUsers() { var userRoleForUser = _context.Roles.FirstOrDefault(r => r.TenantId == 1 && r.Name == StaticRoleNames.Tenants.User); if (userRoleForUser == null) { userRoleForUser = _context.Roles.Add(new Role(1, StaticRoleNames.Tenants.User, StaticRoleNames.Tenants.User) { IsStatic = true, IsDefault = true }).Entity; _context.SaveChanges(); }

        int testUsers_NOR10000 = 10000;
        var testUserNOR1 = _context.Users.FirstOrDefault(u => u.TenantId == 1 && u.UserName == "[email protected]");
        //var testUserNOR51 = _context.Users.FirstOrDefault(u => u.TenantId == null && u.UserName == "[email protected]");
        if (testUserNOR1 == null)
        {
            for (int i = 1; i &lt; testUsers_NOR10000; i++)
            {
                var testUserName = &quot;TestuserNOR&quot; + i + &quot;@testuser.com&quot;;
                var testUserNOR = _context.Users.FirstOrDefault(u =&gt; u.TenantId == null && u.UserName == testUserName);
                if (testUserNOR == null)
                {
                    var testUser = new User
                    {
                        //UserId = Guid.NewGuid(),
                        TenantId = 1,
                        UserName = "TestuserNOR" + i + "@testuser.com",
                        Name = "TestNOR" + i.ToString(),
                        Surname = "UserNOR" + i.ToString(),
                        CountryId = 3,
                        AreaId = 53,
                        SubAreaId = 425,
                        CityId = 1,
                        BirthYear = 1979,
                        Gender = Model.Common.MySolutionEnums.GenderType.Woman,
                        EmailAddress = "TestuserNOR" + i + "@testuser.com",
                        IsEmailConfirmed = true,
                        ShouldChangePasswordOnNextLogin = false,
                        IsActive = true,
                        Password = "AM4OLBpptxBYmM79lGOX9egzZk3vIQU3d/gFCJzaBjAPXzYIK3tQ2N7X4fcrHtElTw==" //123qwe
                    };

                    if (i % 2 == 0)
                    {
                        testUser.Gender = Model.Common.MySolutionEnums.GenderType.Man;
                        testUser.BirthYear = 1972;
                    }

                    if (i % 4 == 0)
                    {
                        testUser.CityId = 2;
                        testUser.BirthYear = 1988;
                    }

                    testUser.SetNormalizedNames();

                    testUserNOR = _context.Users.Add(testUser).Entity;
                    _context.SaveChanges();

                    _context.UserRoles.Add(new UserRole(null, testUserNOR.Id, userRoleForUser.Id));
                    _context.SaveChanges();

                    //User account of test user
                    _context.UserAccounts.Add(new UserAccount
                    {
                        TenantId = 1,
                        UserId = testUserNOR.Id,
                        UserName = testUserNOR.UserName,
                        EmailAddress = testUserNOR.EmailAddress
                    });

                    _context.SaveChanges();
                }

            }
        }


        int testUsers_US = 2000;
        var testUserUS1 = _context.Users.FirstOrDefault(u => u.TenantId == 1 && u.UserName == "[email protected]");
        if (testUserUS1 == null)
        {
            for (int i = 1; i &lt; testUsers_US; i++)
            {
                var testUserName = &quot;TestuserUS&quot; + i + &quot;@testuser.com&quot;;
                var testUserUS = _context.Users.FirstOrDefault(u =&gt; u.TenantId == null && u.UserName == testUserName);
                if (testUserUS == null)
                {
                    var testUser = new User
                    {
                        //UserId = Guid.NewGuid(),
                        TenantId = 1,
                        UserName = "TestuserUS" + i + "@testuser.com",
                        Name = "TestUS" + i.ToString(),
                        Surname = "UserUS" + i.ToString(),
                        EmailAddress = "TestuserUS" + i + "@testuser.com",
                        CountryId = 1,
                        AreaId = 32,
                        CityId = 15,
                        BirthYear = 1979,
                        Gender = Model.Common.MySolutionEnums.GenderType.Woman,
                        IsEmailConfirmed = true,
                        ShouldChangePasswordOnNextLogin = false,
                        IsActive = true,
                        Password = "AM4OLBpptxBYmM79lGOX9egzZk3vIQU3d/gFCJzaBjAPXzYIK3tQ2N7X4fcrHtElTw==" //123qwe
                    };

                    if (i % 2 == 0)
                    {
                        testUser.Gender = Model.Common.MySolutionEnums.GenderType.Man;
                        testUser.BirthYear = 1982;
                    }

                    if (i % 6 == 0)
                    {
                        testUser.CityId = 16;
                        testUser.AreaId = 5;
                        testUser.BirthYear = 1967;
                    }
                    testUser.SetNormalizedNames();

                    testUserUS = _context.Users.Add(testUser).Entity;
                    _context.SaveChanges();

                    //User account of test user
                    _context.UserAccounts.Add(new UserAccount
                    {
                        TenantId = 1,
                        UserId = testUserUS.Id,
                        UserName = testUserUS.UserName,
                        EmailAddress = testUserUS.EmailAddress
                    });

                    _context.SaveChanges();
                }

            }
        }

        var userRoleForCustomer = _context.Roles.FirstOrDefault(r => r.TenantId == 1 && r.Name == StaticRoleNames.Tenants.CustomerContact);
        if (userRoleForCustomer == null)
        {
            userRoleForCustomer = _context.Roles.Add(new Role(1, StaticRoleNames.Tenants.CustomerContact, StaticRoleNames.Tenants.CustomerContact) { IsStatic = true, IsDefault = false }).Entity;
            _context.SaveChanges();
        }
    }

@ismcagdas, thanks. I don't need it now. But maybe I will need this in the future.

I installed a clean database, and now it works. Strange :? Is there any settings in db that can affect this?

Hi, @ismcagdas I have now moved all my code to the fresh template and created a test site in Azure and this works great: <a class="postlink" href="https://testvotechafrontwebapp.azurewebsites.net">https://testvotechafrontwebapp.azurewebsites.net</a>. So my code works.

I used the same code in my prod site with the same database, but I still get the same error. It must be something wrong with my settings in Azure. But I have verified that my App Secret, AppId and Valid OAuth Redirect URIs is correct. If my code works I guess it is no point to send my project to you? But I don't now what can be wrong?

<cite>ismcagdas: </cite> Hi @affern,

I have created an issue here <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/issues/1174">https://github.com/aspnetzero/aspnet-ze ... ssues/1174</a>. Since this is happened in a new template, you don't have to share our project.

Hi @ismcagdas. No, it is no bug in your template. It is just in my solution. I tested your template without my code, and it works fine. But I have added a lot of fields to the User entity, and maybe that is the reason my solution don't work.

Hi @ismcagdas

I have now created a test app with my clean aspnetzero code just to verify that my Facebook settings was ok, and the test app worked great.

So now I have debugged my app in Azure, and I get an error in line 294 in TokenAuthController: loginResult = await _logInManager.LoginAsync(new UserLoginInfo(model.AuthProvider, model.ProviderKey, model.AuthProvider), GetTenancyNameOrNull());

ErrorMessage:

Abp.Domain.Entities.EntityNotFoundException: There is no such an entity. Entity type: GlobalOpinions.Authorization.Users.User, id: 88 at Abp.Domain.Repositories.AbpRepositoryBase2.<GetAsync>d__21.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Threading.InternalAsyncHelper.<AwaitTaskWithPostActionAndFinallyAndGetResult>d__51.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Authorization.Users.AbpUserStore2.<GetUserNameFromDatabaseAsync>d__88.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Authorization.Users.AbpUserManager2.<UpdateAsync>d__47.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Authorization.AbpLogInManager3.<CreateLoginResultAsync>d__38.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Authorization.AbpLogInManager3.<LoginAsyncInternal>d__35.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Authorization.AbpLogInManager3.<LoginAsync>d__34.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Threading.InternalAsyncHelper.<AwaitTaskWithPostActionAndFinallyAndGetResult>d__51.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at GlobalOpinions.Web.Controllers.TokenAuthController.

I'm getting back an user in _userRegistrationManager.RegisterAsync in RegisterExternalUserAsync method, and the parameters model.AuthProvider and model.ProviderKey is ok. But the user is not created in db, and I can't understand why :?

If you do not have any tips on the error messages above, I will send you my project. I really appreciate that you will spend time looking at this :) Have a nice evening!

Hi @ismcagdas My social login buttons is visibile on the login-page but not in "Create profile" page. But this is maybe how it should be?

I can share my project via email, but maybe you can take a look at my page first: <a class="postlink" href="https://votecha.com">https://votecha.com</a> and see if there is something wrong. You can try to register or login with FB if you want. If you try to login with Facebook, I think you will get this error: "There is no entity User with id = 85!". My latest userId is 84, so I think the code tries to create a new user, but something goes wrong.

I'm going to integrate my solution with Facebook, so my users must be able to authenticate with Facebook. I need some data that is not mandatory in facebook's profile, so the user must be able to register the profile on my page. But then I have to make a solution where the user can associate their user id from Facebook to Aspnetzero's userid. I don't know how to debug Facebook authentication with localhost in my development environment. I also do not understand how to change code of aspnetzero core project to handles the authentication. It looks like this code is not open source. Do you have any advice on how I can solve this?

Showing 11 to 20 of 78 entries