feat: hooks for profile mandatory fields
This commit is contained in:
@@ -11,14 +11,17 @@ const hide_profile_for_guest_users = () => {
|
||||
};
|
||||
|
||||
const restrict_users_to_profile_page = () => {
|
||||
if (frappe.session.user != "Guest") {
|
||||
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}`;
|
||||
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);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user