Kaynağa Gözat

Fixed auth ajax request not allowing cross-domain.

tags/2.0.3
Teknikode 4 yıl önce
ebeveyn
işleme
897fd5ecfd

+ 1
- 1
Teknik/Areas/Profile/Views/Profile/Login.cshtml Dosyayı Görüntüle

@@ -2,7 +2,7 @@

@if (Model.Config.UserConfig.LoginEnabled)
{
<form role="form" id="loginForm" action="@Url.SubRouteUrl("www", "Profile.Login")" method="post" accept-charset="UTF-8">
<form role="form" id="loginForm" action="@Url.SubRouteUrl("profile", "Profile.Login")" method="post" accept-charset="UTF-8">
<input name="ReturnUrl" id="ReturnUrl" type="hidden" value="@Model.ReturnUrl" />
<div class="form-group">
<input type="text" class="form-control" id="Username" value="" placeholder="Username" name="Username" data-val-required="The Username field is required." data-val="true" />

+ 1
- 1
Teknik/Areas/Profile/Views/Profile/Register.cshtml Dosyayı Görüntüle

@@ -2,7 +2,7 @@

@if (Model.Config.UserConfig.RegistrationEnabled)
{
<form role="form" id="registrationForm" action="@Url.SubRouteUrl("www", "Profile.Register")" method="post" accept-charset="UTF-8">
<form role="form" id="registrationForm" action="@Url.SubRouteUrl("profile", "Profile.Register")" method="post" accept-charset="UTF-8">
<input name="ReturnUrl" id="ReturnUrl" type="hidden" value="@Model.ReturnUrl" />
<div class="form-group">
<input type="text" class="form-control" id="Username" value="" placeholder="Username" name="Username" data-val-required="The Username field is required." data-val="true"/>

+ 6
- 0
Teknik/Global.asax.cs Dosyayı Görüntüle

@@ -15,6 +15,7 @@ using System.ComponentModel;
using Teknik.Areas.Error.Controllers;
using System.Web.Helpers;
using System.Diagnostics;
using System.Collections.Specialized;

namespace Teknik
{
@@ -54,6 +55,11 @@ namespace Teknik
string elapsedTime = String.Format("{0} seconds", ts.TotalSeconds);

context.Response.AppendHeader("GenerationTime", elapsedTime);

// Allow this domain
string origin = context.Request.Headers.Get("Origin");
if (!string.IsNullOrEmpty(origin))
context.Response.AppendHeader("Access-Control-Allow-Origin", origin);
}

protected void Application_PostAuthenticateRequest(Object sender, EventArgs e)

+ 3
- 0
Teknik/Scripts/Common.js Dosyayı Görüntüle

@@ -12,6 +12,9 @@
type: "POST",
url: form.attr('action'),
data: form.serialize(),
xhrFields: {
withCredentials: true
},
success: function (html) {
if (html.result) {
window.location.reload();

+ 1
- 1
Teknik/Web.config Dosyayı Görüntüle

@@ -46,7 +46,7 @@
</security>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Credentials" value="true" />
<add name="Access-Control-Allow-Methods" value="GET, PUT, POST, DELETE, OPTIONS" />
<add name="Access-Control-Allow-Headers" value="Accept, Content-Type" />
</customHeaders>

Loading…
İptal
Kaydet