Login page can also enter prompt page.

This commit is contained in:
Yang Luo
2021-06-20 22:17:03 +08:00
parent a43db3e55a
commit b189993547
5 changed files with 101 additions and 52 deletions

View File

@ -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;