Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "thobiasxp"

Hi,

This Is my Login Action Controller Coding

public ActionResult Login(string userNameOrEmailAddress = "", string returnUrl = "", string successMessage = "") { if (string.IsNullOrWhiteSpace(returnUrl)) { returnUrl = Url.Action("Index", "Application"); }

        ViewBag.ReturnUrl = returnUrl;
        ViewBag.IsMultiTenancyEnabled = _multiTenancyConfig.IsEnabled;

        return View(
            new LoginFormViewModel
            {
                TenancyName = _tenancyNameFinder.GetCurrentTenancyNameOrNull(),
                IsSelfRegistrationEnabled = IsSelfRegistrationEnabled(),
                SuccessMessage = successMessage,
                UserNameOrEmailAddress = userNameOrEmailAddress
            });
    }

    [HttpPost]
    [UnitOfWork]
    [DisableAuditing]
    public virtual async Task<JsonResult> Login(LoginViewModel loginModel, string returnUrl="" )
    {
        CheckModelState();

        _unitOfWorkManager.Current.DisableFilter(AbpDataFilters.MayHaveTenant);

        var loginResult = await GetLoginResultAsync(loginModel.UsernameOrEmailAddress, loginModel.Password, loginModel.TenancyName);

        if (loginResult.User.ShouldChangePasswordOnNextLogin)
        {
            loginResult.User.SetNewPasswordResetCode();

            return Json(new MvcAjaxResponse
            {
                TargetUrl = Url.Action(
                    "ResetPassword",
                    new ResetPasswordViewModel
                    {
                        UserId = SimpleStringCipher.Encrypt(loginResult.User.Id.ToString()),
                        ResetCode = loginResult.User.PasswordResetCode
                    })
            });
        }

        await SignInAsync(loginResult.User, loginResult.Identity, loginModel.RememberMe);

        if (string.IsNullOrWhiteSpace(returnUrl))
        {
            returnUrl = Url.Action("Index", "Application");
        }

        return Json(new MvcAjaxResponse { TargetUrl = returnUrl });
    }

This is my Login js

var CurrentPage = function () { var handleLogin = function () {

    var $loginForm = $('.login-form');

    $loginForm.validate({
        errorElement: 'span', //default input error message container
        errorClass: 'help-block', // default input error message class
        focusInvalid: false, // do not focus the last invalid input
        rules: {
            username: {
                required: true
            },
            password: {
                required: true
            }
        },

        invalidHandler: function (event, validator) {
            $loginForm.find('.alert-danger').show();
        },

        highlight: function (element) {
            $(element).closest('.form-group').addClass('has-error');
        },

        success: function (label) {
            label.closest('.form-group').removeClass('has-error');
            label.remove();
        },

        errorPlacement: function (error, element) {
            error.insertAfter(element.closest('.input-icon'));
        },

        submitHandler: function (form) {
            $loginForm.find('.alert-danger').hide();
        }
    });

    $loginForm.find('input').keypress(function (e) {
        if (e.which == 13) {
            if ($('.login-form').valid()) {
                $('.login-form').submit();
            }
            return false;
        }
    });

    $loginForm.submit(function (e) {
        e.preventDefault();

        if (!$('.login-form').valid()) {
            return;
        }

        abp.ui.setBusy(
            null,
            abp.ajax({
                contentType: app.consts.contentTypes.formUrlencoded,
                url: $loginForm.attr('action'),
                data: $loginForm.serialize()
            })
        );
    });
    
    $('input[name=usernameOrEmailAddress]').focus();
    $('button[type="submit"]').prop('disabled', false);
}

return {
    init: function () {
        handleLogin();
    }
};

}();

This is my Login c# Html Page

@using Abp.Extensions @using TIBS.stem.MultiTenancy @model TIBS.stem.Web.Models.Account.LoginFormViewModel @section Scripts { <script src="~/Views/Account/Login.js" type="text/javascript"></script> } @{

ViewBag.ReturnUrl = Request["ReturnUrl"];

}

<form class="login-form" action="@Url.Action("Login")[email protected]" method="post"> <h3 class="form-title">@L("LogIn")</h3> <div class="alert alert-danger display-hide"> <button class="close" data-close="alert"></button> <span> <i class="fa fa-warning"></i> @L("PleaseEnterLoginInformation") </span> </div> @if (!Model.SuccessMessage.IsNullOrEmpty()) { <div class="alert alert-success"> <button class="close" data-close="alert"></button> <span> @Model.SuccessMessage </span> </div> } @if (ViewBag.IsMultiTenancyEnabled) { if (Model.TenancyName.IsNullOrEmpty()) { <div class="form-group">

            &lt;label class=&quot;control-label visible-ie8 visible-ie9&quot;&gt;@L("TenancyName")&lt;/label&gt;
            &lt;input class=&quot;form-control form-control-solid placeholder-no-fix&quot; type=&quot;text&quot; placeholder=&quot;@L(&quot;TenancyName&quot;)&quot; name=&quot;tenancyName&quot; maxlength=&quot;@Tenant.MaxTenancyNameLength&quot; /&gt;
        &lt;/div&gt;
    }
    else
    {
        &lt;input type=&quot;hidden&quot; name=&quot;tenancyName&quot; value=&quot;@Model.TenancyName&quot; /&gt;
    }
}
&lt;div class=&quot;form-group&quot;&gt;
    
    &lt;label class=&quot;control-label visible-ie8 visible-ie9&quot;&gt;@L("UserNameOrEmail")&lt;/label&gt;
    &lt;input class=&quot;form-control form-control-solid placeholder-no-fix&quot; type=&quot;text&quot; autocomplete=&quot;off&quot; placeholder=&quot;@L(&quot;UserNameOrEmail&quot;)&quot; name=&quot;usernameOrEmailAddress&quot; value=&quot;@(Model.UserNameOrEmailAddress ?? &quot;&quot;)&quot; required /&gt;
&lt;/div&gt;
&lt;div class=&quot;form-group&quot;&gt;
    &lt;label class=&quot;control-label visible-ie8 visible-ie9&quot;&gt;@L("Password")&lt;/label&gt;
    &lt;input class=&quot;form-control form-control-solid placeholder-no-fix&quot; type=&quot;password&quot; autocomplete=&quot;off&quot; placeholder=&quot;@L(&quot;Password&quot;)&quot; name=&quot;password&quot; /&gt;
&lt;/div&gt;
&lt;div class=&quot;form-actions&quot;&gt;
    &lt;button type=&quot;submit&quot; class=&quot;btn btn-success uppercase&quot; disabled=&quot;disabled&quot;&gt; @L("LogIn")&lt;/button&gt;
    &lt;label class=&quot;rememberme check&quot;&gt;
        &lt;input type=&quot;checkbox&quot; name=&quot;rememberMe&quot; value=&quot;true&quot; /&gt;@L("RememberMe")
    &lt;/label&gt;
    &lt;a href=&quot;@Url.Action(&quot;ForgotPassword&quot;, &quot;Account&quot;)&quot; id=&quot;forget-password&quot; class=&quot;forget-password&quot;&gt;@L("ForgotPassword")&lt;/a&gt;
&lt;/div&gt;

</form>

Kindly Give me a solution Where i am wrong

Thanks,

Hi,

I have tried to used to Impersonate login and Link User Login in out Module Zero Project. When i try to login it's only goes to the 500 error page with the error message of "Impersonation token is invalid or expired!". i just expand the Cache memory time from 1 minute to 5 minutes. but still facing the same issue. i have Attached the error screen shot also. Give a idea to resolve this issue.

Thanks,

Hi,

Kindly give a suggestion Regarding the Return Url. It's helps to fix that issue as earliest.

Thank You,

Hi Ibrahim,

We Want to use the Asp.Web ApI's into one of our Mobile Applications. I tried to getting the data's from webApi through Advanced Rest Client but it only gives the response of "Internal Server Error". I post the ASP.NET_SessionId,__RequestVerificationToken,.AspNet.ApplicationCookie also. But i am not able to get the Data's. Kindly give the possible ways to use That Api's.

Thanks,

Question

Hi,

I have Getting Some Return Url's while user getting Logged in. Also Passing that Return Url to Target Url. But Target Url does Not Working. It got stuckup in that Login only. So kindly guide me how can we allow return Url's in Module Zero. How to Pass the Return Url's after Getting Login.

Have a Great Day.. :) Thanks,

Hi,

Thanks a Lot...Now it's works fine.

Thanks,

Hi,

I Have download a latest version Asp.net Zero Project. When i perform a initial build i got the Error in Test Application Project where all we used [ Fact] Attribute. it Shows like " ". it already restore all the nuget packages and also my visual studio updates are in Up to Date. but still i am getting that issues. attach screen shot too...kindly give a solution for this ASAP.

Thanks,

Hi,

I have one issue. I add two references(Abp.Zero.Entityframework, Abp.EntityFramework) in the Application Project for calling sp's. At the time on wards i got the internal error occurred message where we mapped abpuser table as a foreign key. application method did not find before i got the error only. Give a solution for this.

Thanks...

Hi,

I want to Add SignalR in Module Zero for board cast ream time sql data. how to add this in Module Zero. Give a sugggestion for how to integrate signalR in Module Zero. This will help me more. Give a Reply ASAP.

Thanks...

Hi,

But it's most important for me. because we could not identified what are the issues arise in controller. can i get any other alternative way for solve this..for resolving this only i will move to forward. kindly give a possible solution.

Thanks...

Showing 31 to 40 of 64 entries