Base solution for your next web application
Open Closed

Manage users and re-CAPTCHA #3072


User avatar
0
fguo created

I’m trying version 4.0 (Core + Angular), and got some difficulties on registering new users. Here are my questions:

  1. On localhost, I tried to use “CREATE ACCOUNT” on Login page. It pops up a “Sign up” form. After filling up all info, check off “I’m not a robot”, and click “Submit” button, I got an error “An internal error occurred during your request!” What I missed?

  2. On release mode, according to Documents/Development-Guide-Angular, I need to replace reCAPTCHA keys in appsettings.json file in the server side and in the register.component.html in the client side. I can easily replace a site key on server side appsettings.production.json, but I cannot find the “register.component.html” in client side “dist” folder. Do I need to replace the key on original “register.component.html” and publish it again?

  3. As the document, “Recaptcha (security question) is optional”. How do I disable “Recaptcha”?

  4. There seem two ways to add new users. One is by user self from “CREATE ACCOUNT” on Login page, and one is by Admin from “CREATE NEW USER” from Administration > Users page. How do I block users from creating account by themselves?

  5. In case of allowing users creating account by themselves, how to assign a default Role or make inactive until admin grants the access?

Thanks,


6 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    1. Can you check Logs.txt file under your web project ? It should contain a detailed error message about this.

    2. It is better to replace after publishing your app to dist folder. The file should be under "dist/account/register/register.component.html".

    3. When you login as Tenant admin, go to settings page and there is a setting under "User Management" tab Use security image question (captcha) on registration.

    4. Also there is a setting in "User Management" tab called "Allow users to register to the system.".

    5. You can either select a role as default by editing a role in role list and select "Default" checkbox or under the "User Management" tab in settings page, you can enable/disable setting "New registered users are active by default."

    Thanks.

  • User Avatar
    0
    fguo created
    1. Here is the message I found from Log: System.IO.FileLoadException: Could not load file or assembly 'System.Diagnostics.DiagnosticSource, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

    2. Under my dist folder, there is only an "asset" folder. I couldn't find the "account" folder.

    3.4.5. I understand now.

    Thank you!

  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    1. It's a bug from System.Net.Http 4.3.0 package. Can you try to add System.Net.Http 4.3.1 package to your web project? See releated issue: <a class="postlink" href="https://github.com/aspnet/JavaScriptServices/issues/487#issuecomment-282143521">https://github.com/aspnet/JavaScriptSer ... -282143521</a>

    2. It seems you should change it and publish again since it's hard-coded in the html file. We should take this to the configuration file in the next version. I created an issue for that, please follow: <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/issues/183">https://github.com/aspnetzero/aspnet-ze ... issues/183</a>

    Have a nice day.

  • User Avatar
    0
    fguo created

    I just added System.Net.Http 4.3.1 package to my Web.Host project (Instead of Web.Core, right?), and tried again. I still get same "Internal Error" popup. The log text this time is:

    MailKit.Net.Smtp.SmtpProtocolException: The SMTP server has unexpectedly disconnected.

    Any clue?

  • User Avatar
    0
    fguo created

    I also added System.Net.Http 4.3.1 package to my Web.Core project and tried again. I still get same "Internal Error" popup. Here is the log text:

    MailKit.Net.Smtp.SmtpProtocolException: The SMTP server has unexpectedly disconnected.

    at MailKit.Net.Smtp.SmtpStream.ReadAhead(CancellationToken cancellationToken)

    at MailKit.Net.Smtp.SmtpStream.ReadResponse(CancellationToken cancellationToken)

    at MailKit.Net.Smtp.SmtpClient.Connect(String host, Int32 port, SecureSocketOptions options, CancellationToken cancellationToken)

    at MailKit.MailService.Connect(String host, Int32 port, Boolean useSsl, CancellationToken cancellationToken)

    at Abp.MailKit.DefaultMailKitSmtpBuilder.ConfigureClient(SmtpClient client)

    at Abp.MailKit.DefaultMailKitSmtpBuilder.Build()

    at Abp.MailKit.MailKitEmailSender.BuildSmtpClient()

    at Abp.MailKit.MailKitEmailSender.<SendAsync>d__2.MoveNext()

    --- End of stack trace from previous location where exception was thrown ---

    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)

    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

    at Abp.Net.Mail.EmailSenderBase.<SendAsync>d__4.MoveNext()

    --- End of stack trace from previous location where exception was thrown ---

    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)

    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

    at SNet.Authorization.Users.UserEmailer.<SendEmailActivationLinkAsync>d__5.MoveNext()

    --- End of stack trace from previous location where exception was thrown ---

    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)

    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

    at Abp.Threading.InternalAsyncHelper.<AwaitTaskWithPostActionAndFinally>d__1.MoveNext()

    --- End of stack trace from previous location where exception was thrown ---

    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)

    at System.Runtime.CompilerServices.TaskAwaiter.Hand...

  • User Avatar
    0
    hikalkan created
    Support Team

    I suppose "Could not load file or assembly System.Diagnostics.DiagnosticSource" is fixed but you have still problems with sending emails? If so, you should check your SMTP server and email settings, that's not directly related to AspNet Zero. We simply use MailKit to send emails. If you believe that AspNet Zero has problems, then can you try to directly use MailKit to sending an emal. It's pretty easy: <a class="postlink" href="https://github.com/jstedfast/MailKit#using-mailkit">https://github.com/jstedfast/MailKit#using-mailkit</a>