Browse Source

Merge branch 'master' of http://git.teknik.io/teknikode/teknik.git

pull/29/head
Teknikode 6 years ago
parent
commit
245a72f191
  1. 2
      Teknik/Areas/Podcast/Scripts/Podcast.js
  2. 12
      Teknik/Areas/Profile/Controllers/ProfileController.cs
  3. 8
      Teknik/Global.asax.cs
  4. 3
      Teknik/Scripts/Common.js

2
Teknik/Areas/Podcast/Scripts/Podcast.js

@ -116,7 +116,7 @@ @@ -116,7 +116,7 @@
episode = $("#edit_podcast_episode").val();
title = $("#edit_podcast_title").val();
description = $("#edit_podcast_description").val();
allFiles = $("#edit_podcast_cur_files").val();
allFiles = $("#edit_podcast_cur_file_list").val();
fd.append("podcastId", podcastId);
fd.append("episode", episode);

12
Teknik/Areas/Profile/Controllers/ProfileController.cs

@ -146,9 +146,13 @@ namespace Teknik.Areas.Profile.Controllers @@ -146,9 +146,13 @@ namespace Teknik.Areas.Profile.Controllers
{
authcookie.Domain = string.Format("dev.{0}", Request.Url.Host.GetDomain());
}
#if DEBUG
authcookie.Domain = Request.Url.Host.GetDomain();
#endif
// Make it work for localhost
if (Request.IsLocal)
{
authcookie.Domain = Request.Url.Host.GetDomain();
authcookie.HttpOnly = false;
authcookie.Secure = false;
}
Response.Cookies.Add(authcookie);
if (string.IsNullOrEmpty(model.ReturnUrl))
@ -234,7 +238,7 @@ namespace Teknik.Areas.Profile.Controllers @@ -234,7 +238,7 @@ namespace Teknik.Areas.Profile.Controllers
// Add gogs user
using (var client = new WebClient())
{
var obj = new { source_id = Config.GitConfig.SourceId, username = model.Username, email = email, password = model.Password };
var obj = new { source_id = Config.GitConfig.SourceId, username = model.Username, email = email, login_name = email, password = model.Password };
string json = Newtonsoft.Json.JsonConvert.SerializeObject(obj);
client.Headers[HttpRequestHeader.ContentType] = "application/json";
Uri baseUri = new Uri(Config.GitConfig.Host);

8
Teknik/Global.asax.cs

@ -58,8 +58,14 @@ namespace Teknik @@ -58,8 +58,14 @@ namespace Teknik
// Allow this domain
string origin = context.Request.Headers.Get("Origin");
if (!string.IsNullOrEmpty(origin))
if (!string.IsNullOrEmpty(origin) && !Request.IsLocal)
{
context.Response.AppendHeader("Access-Control-Allow-Origin", origin);
}
else if (Request.IsLocal)
{
context.Response.AppendHeader("Access-Control-Allow-Origin", "*");
}
}
protected void Application_PostAuthenticateRequest(Object sender, EventArgs e)

3
Teknik/Scripts/Common.js

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

Loading…
Cancel
Save