mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-04 21:30:24 +08:00
Login page can also enter prompt page.
This commit is contained in:
@ -108,6 +108,41 @@ export function hasPromptPage(application) {
|
||||
return isAffiliationPrompted(application);
|
||||
}
|
||||
|
||||
function isAffiliationAnswered(user, application) {
|
||||
if (!isAffiliationPrompted(application)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (user === null) {
|
||||
return false;
|
||||
}
|
||||
return user.affiliation !== "";
|
||||
}
|
||||
|
||||
function isProviderItemAnswered(user, application, providerItem) {
|
||||
if (user === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const provider = providerItem.provider;
|
||||
const linkedValue = user[provider.type.toLowerCase()];
|
||||
return linkedValue !== undefined && linkedValue !== "";
|
||||
}
|
||||
|
||||
export function isPromptAnswered(user, application) {
|
||||
if (!isAffiliationAnswered(user, application)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const providerItems = getAllPromptedProviderItems(application);
|
||||
for (let i = 0; i < providerItems.length; i ++) {
|
||||
if (!isProviderItemAnswered(user, application, providerItems[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
export function parseJson(s) {
|
||||
if (s === "") {
|
||||
return null;
|
||||
|
Reference in New Issue
Block a user