Merge branch 'release/v1.0.0' of https://github.com/ONLYOFFICE/DocSpace into release/v1.0.0

This commit is contained in:
Ilya Sobolev 2023-04-19 19:10:58 +03:00
commit 5190a1d035
2 changed files with 20 additions and 10 deletions

View File

@ -661,8 +661,7 @@ public class FileUtility
".html", ".htm", ".mht", ".xml",
".pdf", ".djvu", ".fb2", ".epub", ".xps",".oxps",
".doct", ".docy",
".gdoc",
".docxf", ".oform"
".gdoc"
};
public static readonly List<string> ExtsFormTemplate = new List<string>

View File

@ -186,8 +186,14 @@ public class SsoHandlerService
_log.DebugUserAlreadyAuthenticated(context.User.Identity);
}
}
userInfo = await AddUser(userInfo);
try
{
userInfo = await AddUser(userInfo);
}
catch(Exception ex)
{
_log.WarningWithException("Failed to save user", ex);
}
var authKey = _cookiesManager.AuthenticateMeAndSetCookies(userInfo.Tenant, userInfo.Id, MessageAction.LoginSuccessViaSSO);
@ -228,12 +234,12 @@ public class SsoHandlerService
catch (SSOException e)
{
_log.ErrorWithException(e);
await WriteErrorToResponse(context, e.MessageKey);
RedirectToLogin(context, e.MessageKey);
}
catch (Exception e)
{
_log.ErrorWithException(e);
await WriteErrorToResponse(context, MessageKey.Error);
RedirectToLogin(context, MessageKey.Error);
}
finally
{
@ -241,12 +247,17 @@ public class SsoHandlerService
//context.ApplicationInstance.CompleteRequest();
}
}
private void RedirectToLogin(HttpContext context, MessageKey messageKey)
{
context.Response.Redirect(_commonLinkUtility.GetDefault() + "/login/error?messageKey=" + messageKey, false);
}
//TODO
private async Task WriteErrorToResponse(HttpContext context, MessageKey messageKey)
{
context.Response.StatusCode = 500;
context.Response.ContentType = "text/plain";
await context.Response.WriteAsync(((int)messageKey).ToString());
context.Response.StatusCode = 500;
context.Response.ContentType = "text/plain";
await context.Response.WriteAsync(((int)messageKey).ToString());
}
private async Task<UserInfo> AddUser(UserInfo userInfo)
@ -289,7 +300,7 @@ public class SsoHandlerService
throw new Exception(Resource.ErrorIncorrectUserName);
}
await _userManager.SaveUserInfo(newUserInfo);
await _userManager.UpdateUserInfo(newUserInfo);
}
/*var photoUrl = samlResponse.GetRemotePhotoUrl();