feat: hooks for profile mandatory fields
This commit is contained in:
@@ -71,7 +71,7 @@
|
|||||||
{
|
{
|
||||||
"fieldname": "profile_restrictions_section",
|
"fieldname": "profile_restrictions_section",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
"label": "Profile Restrictions"
|
"label": "Profile"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"default": "0",
|
"default": "0",
|
||||||
@@ -83,7 +83,7 @@
|
|||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"issingle": 1,
|
"issingle": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-12-15 11:30:06.506403",
|
"modified": "2021-12-20 12:11:26.628925",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "LMS",
|
"module": "LMS",
|
||||||
"name": "LMS Settings",
|
"name": "LMS Settings",
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
"is_standard": 1,
|
"is_standard": 1,
|
||||||
"login_required": 1,
|
"login_required": 1,
|
||||||
"max_attachment_size": 0,
|
"max_attachment_size": 0,
|
||||||
"modified": "2021-12-14 16:35:24.751439",
|
"modified": "2021-12-20 13:20:19.810134",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "LMS",
|
"module": "LMS",
|
||||||
"name": "profile",
|
"name": "profile",
|
||||||
@@ -335,7 +335,7 @@
|
|||||||
"max_value": 0,
|
"max_value": 0,
|
||||||
"options": "",
|
"options": "",
|
||||||
"read_only": 0,
|
"read_only": 0,
|
||||||
"reqd": 1,
|
"reqd": 0,
|
||||||
"show_in_filter": 0
|
"show_in_filter": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ class CustomUser(User):
|
|||||||
super(CustomUser, self).validate()
|
super(CustomUser, self).validate()
|
||||||
self.validate_username_characters()
|
self.validate_username_characters()
|
||||||
self.validate_skills()
|
self.validate_skills()
|
||||||
|
self.validate_completion()
|
||||||
|
|
||||||
def validate_username_characters(self):
|
def validate_username_characters(self):
|
||||||
if len(self.username):
|
if len(self.username):
|
||||||
|
|||||||
@@ -11,14 +11,17 @@ const hide_profile_for_guest_users = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const restrict_users_to_profile_page = () => {
|
const restrict_users_to_profile_page = () => {
|
||||||
if (frappe.session.user != "Guest") {
|
setTimeout(() => {
|
||||||
frappe.call({
|
var link_array = $('.nav-link').filter((i, elem) => $(elem).text().trim() === "My Profile");
|
||||||
"method": "school.lms.doctype.lms_settings.lms_settings.check_profile_restriction",
|
if (frappe.session.user != "Guest" && link_array.length && !$(link_array[0]).hasClass("active")) {
|
||||||
"callback": (data) => {
|
frappe.call({
|
||||||
if (data.message && data.message.redirect) {
|
"method": "school.lms.doctype.lms_settings.lms_settings.check_profile_restriction",
|
||||||
window.location.href = `${data.message.prefix}${data.message.username}`;
|
"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