fix: restrict profile and mark as complete

This commit is contained in:
Jannat Patel
2021-12-21 11:11:39 +05:30
parent ea06fe8cf8
commit ff702c9d14
21 changed files with 110 additions and 45 deletions

View File

@@ -1,6 +1,5 @@
frappe.ready(() => {
hide_profile_for_guest_users();
restrict_users_to_profile_page();
});
const hide_profile_for_guest_users = () => {
@@ -9,19 +8,3 @@ const hide_profile_for_guest_users = () => {
link_array.length && $(link_array[0]).addClass("hide");
}
};
const restrict_users_to_profile_page = () => {
setTimeout(() => {
var link_array = $('.nav-link').filter((i, elem) => $(elem).text().trim() === "My Profile");
if (frappe.session.user != "Guest" && link_array.length && !$(link_array[0]).hasClass("active")) {
frappe.call({
"method": "school.lms.doctype.lms_settings.lms_settings.check_profile_restriction",
"callback": (data) => {
if (data.message && data.message.redirect) {
window.location.href = `${data.message.prefix}${data.message.username}`;
}
}
});
}
}, 10);
};