/// <summary> /// Logs the user in and returns either an empty 200 response for ajax requests, or a redirect response for non-ajax. <seealso cref="M:Nancy.Extensions.RequestExtensions.IsAjaxRequest(Nancy.Request)" /> /// </summary> /// <param name="module">Nancy module</param> /// <param name="userIdentifier">User identifier guid</param> /// <param name="cookieExpiry">Optional expiry date for the cookie (for 'Remember me')</param> /// <param name="fallbackRedirectUrl">Url to redirect to if none in the querystring</param> /// <returns>Nancy response with redirect if request was not ajax, otherwise with OK.</returns> public static Response Login(this INancyModule module, Guid userIdentifier, DateTime?cookieExpiry = null, string fallbackRedirectUrl = "/") { if (!module.Context.Request.IsAjaxRequest()) { return(module.LoginAndRedirect(userIdentifier, cookieExpiry, fallbackRedirectUrl)); } return(module.LoginWithoutRedirect(userIdentifier, cookieExpiry)); }