Merge branch 'feature/oauth2.0' of github.com:ONLYOFFICE/AppServer into feature/oauth2.0
This commit is contained in:
commit
c45cfe87a1
@ -1554,18 +1554,41 @@ namespace ASC.Employee.Core.Controllers
|
||||
}
|
||||
|
||||
var thirdPartyProfile = new LoginProfile(Signature, InstanceCrypto, model.SerializedProfile);
|
||||
var newUser = CreateNewUser(GetFirstName(model, thirdPartyProfile), GetLastName(model, thirdPartyProfile), GetEmailAddress(model, thirdPartyProfile), passwordHash, employeeType, false);
|
||||
|
||||
var messageAction = employeeType == EmployeeType.User ? MessageAction.UserCreatedViaInvite : MessageAction.GuestCreatedViaInvite;
|
||||
MessageService.Send(MessageInitiator.System, messageAction, MessageTarget.Create(newUser.ID), newUser.DisplayUserName(false, DisplayUserSettingsHelper));
|
||||
|
||||
var userID = newUser.ID;
|
||||
if (!string.IsNullOrEmpty(thirdPartyProfile.Avatar))
|
||||
if (!string.IsNullOrEmpty(thirdPartyProfile.AuthorizationError))
|
||||
{
|
||||
SaveContactImage(userID, thirdPartyProfile.Avatar);
|
||||
// ignore cancellation
|
||||
if (thirdPartyProfile.AuthorizationError != "Canceled at provider")
|
||||
throw new Exception(thirdPartyProfile.AuthorizationError);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
GetLinker().AddLink(userID.ToString(), thirdPartyProfile);
|
||||
if (string.IsNullOrEmpty(thirdPartyProfile.EMail))
|
||||
{
|
||||
throw new Exception(Resource.ErrorNotCorrectEmail);
|
||||
}
|
||||
|
||||
var userID = Guid.Empty;
|
||||
try
|
||||
{
|
||||
SecurityContext.AuthenticateMe(ASC.Core.Configuration.Constants.CoreSystem);
|
||||
var newUser = CreateNewUser(GetFirstName(model, thirdPartyProfile), GetLastName(model, thirdPartyProfile), GetEmailAddress(model, thirdPartyProfile), passwordHash, employeeType, false);
|
||||
|
||||
var messageAction = employeeType == EmployeeType.User ? MessageAction.UserCreatedViaInvite : MessageAction.GuestCreatedViaInvite;
|
||||
MessageService.Send(MessageInitiator.System, messageAction, MessageTarget.Create(newUser.ID), newUser.DisplayUserName(false, DisplayUserSettingsHelper));
|
||||
|
||||
userID = newUser.ID;
|
||||
if (!string.IsNullOrEmpty(thirdPartyProfile.Avatar))
|
||||
{
|
||||
SaveContactImage(userID, thirdPartyProfile.Avatar);
|
||||
}
|
||||
|
||||
GetLinker().AddLink(userID.ToString(), thirdPartyProfile);
|
||||
}
|
||||
finally
|
||||
{
|
||||
SecurityContext.Logout();
|
||||
}
|
||||
|
||||
var user = UserManager.GetUsers(userID);
|
||||
var cookiesKey = SecurityContext.AuthenticateMe(user.Email, passwordHash);
|
||||
@ -1581,6 +1604,7 @@ namespace ASC.Employee.Core.Controllers
|
||||
UserHelpTourHelper.IsNewUser = true;
|
||||
if (CoreBaseSettings.Personal)
|
||||
PersonalSettingsHelper.IsNewUser = true;
|
||||
|
||||
}
|
||||
|
||||
[Create("phone")]
|
||||
|
Loading…
Reference in New Issue
Block a user