feat: hooks for profile mandatory fields
This commit is contained in:
@@ -71,7 +71,7 @@
|
||||
{
|
||||
"fieldname": "profile_restrictions_section",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Profile Restrictions"
|
||||
"label": "Profile"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
@@ -83,7 +83,7 @@
|
||||
"index_web_pages_for_search": 1,
|
||||
"issingle": 1,
|
||||
"links": [],
|
||||
"modified": "2021-12-15 11:30:06.506403",
|
||||
"modified": "2021-12-20 12:11:26.628925",
|
||||
"modified_by": "Administrator",
|
||||
"module": "LMS",
|
||||
"name": "LMS Settings",
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
"is_standard": 1,
|
||||
"login_required": 1,
|
||||
"max_attachment_size": 0,
|
||||
"modified": "2021-12-14 16:35:24.751439",
|
||||
"modified": "2021-12-20 13:20:19.810134",
|
||||
"modified_by": "Administrator",
|
||||
"module": "LMS",
|
||||
"name": "profile",
|
||||
@@ -335,7 +335,7 @@
|
||||
"max_value": 0,
|
||||
"options": "",
|
||||
"read_only": 0,
|
||||
"reqd": 1,
|
||||
"reqd": 0,
|
||||
"show_in_filter": 0
|
||||
},
|
||||
{
|
||||
|
||||
@@ -12,6 +12,7 @@ class CustomUser(User):
|
||||
super(CustomUser, self).validate()
|
||||
self.validate_username_characters()
|
||||
self.validate_skills()
|
||||
self.validate_completion()
|
||||
|
||||
def validate_username_characters(self):
|
||||
if len(self.username):
|
||||
|
||||
@@ -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