fix null auto link options.
This commit is contained in:
@@ -32,7 +32,7 @@ namespace Umbraco.Cms.Web.BackOffice.Security
|
||||
/// <summary>
|
||||
/// Options used to control how users can be auto-linked/created/updated based on the external login provider
|
||||
/// </summary>
|
||||
public ExternalSignInAutoLinkOptions AutoLinkOptions { get; set; }
|
||||
public ExternalSignInAutoLinkOptions AutoLinkOptions { get; set; } = new ExternalSignInAutoLinkOptions();
|
||||
|
||||
/// <summary>
|
||||
/// When set to true will disable all local user login functionality
|
||||
|
||||
@@ -5,63 +5,66 @@
|
||||
**/
|
||||
function externalLoginInfoService(externalLoginInfo, umbRequestHelper) {
|
||||
|
||||
function getLoginProvider(provider) {
|
||||
if (provider) {
|
||||
var found = _.find(externalLoginInfo.providers, x => x.authType == provider);
|
||||
return found;
|
||||
}
|
||||
return null;
|
||||
function getLoginProvider(provider) {
|
||||
if (provider) {
|
||||
var found = _.find(externalLoginInfo.providers, x => x.authType == provider);
|
||||
return found;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function getLoginProviderView(provider) {
|
||||
if (provider && provider.properties && provider.properties.CustomBackOfficeView) {
|
||||
return umbRequestHelper.convertVirtualToAbsolutePath(provider.properties.CustomBackOfficeView);
|
||||
}
|
||||
return null;
|
||||
function getLoginProviderView(provider) {
|
||||
if (provider && provider.properties && provider.properties.CustomBackOfficeView) {
|
||||
return umbRequestHelper.convertVirtualToAbsolutePath(provider.properties.CustomBackOfficeView);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if any provider denies local login if `provider` is null, else whether the passed
|
||||
* @param {any} provider
|
||||
*/
|
||||
function hasDenyLocalLogin(provider) {
|
||||
if (!provider) {
|
||||
return _.some(externalLoginInfo.providers, x => x.properties && (x.properties.DenyLocalLogin === true));
|
||||
}
|
||||
else {
|
||||
return provider && provider.properties && (provider.properties.DenyLocalLogin === true);
|
||||
}
|
||||
/**
|
||||
* Returns true if any provider denies local login if `provider` is null, else whether the passed
|
||||
* @param {any} provider
|
||||
*/
|
||||
function hasDenyLocalLogin(provider) {
|
||||
if (!provider) {
|
||||
return _.some(externalLoginInfo.providers, x => x.properties && (x.properties.DenyLocalLogin === true));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all login providers
|
||||
*/
|
||||
function getLoginProviders() {
|
||||
return externalLoginInfo.providers;
|
||||
else {
|
||||
return provider && provider.properties && (provider.properties.DenyLocalLogin === true);
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns all logins providers that have options that the user can interact with */
|
||||
function getLoginProvidersWithOptions() {
|
||||
// only include providers that allow manual linking or ones that provide a custom view
|
||||
var providers = _.filter(externalLoginInfo.providers, x => {
|
||||
// transform the data and also include the custom view as a nicer property
|
||||
x.customView = getLoginProviderView(x);
|
||||
if (x.customView) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return x.properties.AutoLinkOptions.AllowManualLinking;
|
||||
}
|
||||
});
|
||||
return providers;
|
||||
}
|
||||
/**
|
||||
* Returns all login providers
|
||||
*/
|
||||
function getLoginProviders() {
|
||||
return externalLoginInfo.providers;
|
||||
}
|
||||
|
||||
return {
|
||||
hasDenyLocalLogin: hasDenyLocalLogin,
|
||||
getLoginProvider: getLoginProvider,
|
||||
getLoginProviders: getLoginProviders,
|
||||
getLoginProvidersWithOptions: getLoginProvidersWithOptions,
|
||||
getLoginProviderView: getLoginProviderView
|
||||
};
|
||||
/** Returns all logins providers that have options that the user can interact with */
|
||||
function getLoginProvidersWithOptions() {
|
||||
// only include providers that allow manual linking or ones that provide a custom view
|
||||
var providers = _.filter(externalLoginInfo.providers, x => {
|
||||
// transform the data and also include the custom view as a nicer property
|
||||
x.customView = getLoginProviderView(x);
|
||||
if (x.customView) {
|
||||
return true;
|
||||
}
|
||||
else if (x.properties.AutoLinkOptions) {
|
||||
return x.properties.AutoLinkOptions.AllowManualLinking;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
return providers;
|
||||
}
|
||||
|
||||
return {
|
||||
hasDenyLocalLogin: hasDenyLocalLogin,
|
||||
getLoginProvider: getLoginProvider,
|
||||
getLoginProviders: getLoginProviders,
|
||||
getLoginProvidersWithOptions: getLoginProvidersWithOptions,
|
||||
getLoginProviderView: getLoginProviderView
|
||||
};
|
||||
}
|
||||
angular.module('umbraco.services').factory('externalLoginInfoService', externalLoginInfoService);
|
||||
|
||||
Reference in New Issue
Block a user