<commit_before>frappe.ui.form.on('User', {
	before_load: function(frm) {
		var update_tz_select = function(user_language) {
			frm.set_df_property("time_zone", "options", [""].concat(frappe.all_timezones));
		}

		if(!frappe.all_timezones) {
			frappe.call({
				method: "frappe.core.doctype.user.user.get_timezones",
				callback: function(r) {
					frappe.all_timezones = r.message.timezones;
					update_tz_select();
				}
			});
		} else {
			update_tz_select();
		}

	},
	onload: function(frm) {
		if(has_common(roles, ["Administrator", "System Manager"]) && !frm.doc.__islocal) {
			if(!frm.roles_editor) {
				var role_area = $('<div style="min-height: 300px">')
					.appendTo(frm.fields_dict.roles_html.wrapper);
				frm.roles_editor = new frappe.RoleEditor(role_area, frm);

				var module_area = $('<div style="min-height: 300px">')
					.appendTo(frm.fields_dict.modules_html.wrapper);
				frm.module_editor = new frappe.ModuleEditor(frm, module_area)
			} else {
				frm.roles_editor.show();
			}
		}
	},
	refresh: function(frm) {
		var doc = frm.doc;

		if(doc.name===user && !doc.__unsaved
			&& frappe.all_timezones
			&& (doc.language || frappe.boot.user.language)
			&& doc.language !== frappe.boot.user.language) {
			msgprint(__("Refreshing..."));
			window.location.reload();
		}

		frm.toggle_display(['sb1', 'sb3', 'modules_access'], false);

		if(!doc.__islocal){
			frm.add_custom_button(__("Set Desktop Icons"), function() {
				frappe.route_options = {
					"user": doc.name
				};
				frappe.set_route("modules_setup");
			}, null, "btn-default")

			if(has_common(roles, ["Administrator", "System Manager"])) {

				frm.add_custom_button(__("Set User Permissions"), function() {
					frappe.route_options = {
						"user": doc.name
					};
					frappe.set_route("user-permissions");
				}, null, "btn-default")

				frm.toggle_display(['sb1', 'sb3', 'modules_access'], true);
			}
			frm.trigger('enabled');

			frm.roles_editor && frm.roles_editor.show();
			frm.module_editor && frm.module_editor.refresh();

			if(user==doc.name) {
				// update display settings
				if(doc.user_image) {
					frappe.boot.user_info[user].image = frappe.utils.get_file_link(doc.user_image);<commit_msg>Added reset password button to User doctype (#3089)<commit_after>frappe.ui.form.on('User', {
	before_load: function(frm) {
		var update_tz_select = function(user_language) {
			frm.set_df_property("time_zone", "options", [""].concat(frappe.all_timezones));
		}

		if(!frappe.all_timezones) {
			frappe.call({
				method: "frappe.core.doctype.user.user.get_timezones",
				callback: function(r) {
					frappe.all_timezones = r.message.timezones;
					update_tz_select();
				}
			});
		} else {
			update_tz_select();
		}

	},
	onload: function(frm) {
		if(has_common(roles, ["Administrator", "System Manager"]) && !frm.doc.__islocal) {
			if(!frm.roles_editor) {
				var role_area = $('<div style="min-height: 300px">')
					.appendTo(frm.fields_dict.roles_html.wrapper);
				frm.roles_editor = new frappe.RoleEditor(role_area, frm);

				var module_area = $('<div style="min-height: 300px">')
					.appendTo(frm.fields_dict.modules_html.wrapper);
				frm.module_editor = new frappe.ModuleEditor(frm, module_area)
			} else {
				frm.roles_editor.show();
			}
		}
	},
	refresh: function(frm) {
		var doc = frm.doc;

		if(doc.name===user && !doc.__unsaved
			&& frappe.all_timezones
			&& (doc.language || frappe.boot.user.language)
			&& doc.language !== frappe.boot.user.language) {
			msgprint(__("Refreshing..."));
			window.location.reload();
		}

		frm.toggle_display(['sb1', 'sb3', 'modules_access'], false);

		if(!doc.__islocal){
			frm.add_custom_button(__("Set Desktop Icons"), function() {
				frappe.route_options = {
					"user": doc.name
				};
				frappe.set_route("modules_setup");
			}, null, "btn-default")

			if(has_common(roles, ["Administrator", "System Manager"])) {

				frm.add_custom_button(__("Set User Permissions"), function() {
					frappe.route_options = {
						"user": doc.name
					};
					frappe.set_route("user-permissions");
				}, null, "btn-default")

				frm.toggle_display(['sb1', 'sb3', 'modules_access'], true);
			}
			
			frm.add_custom_button(__("Reset Password"), function() {
				frappe.call({
					method: "frappe.core.doctype.user.user.reset_password",
					args: {
						"user": frm.doc.name
					}
				})
			})

			frm.trigger('enabled');

			frm.roles_editor && frm.roles_editor.show();
			frm.module_editor && frm.module_editor.refresh();

			if(user==doc.name) {
				// update display settings
				if(doc.user_image) {
					frappe.boot.user_info[user].image = frappe.utils.get_file_link(doc.user_image);
{'fraction_non_alphanumeric': 0.1730851519041506, 'fraction_numerical': 0.005134788189987163, 'mean_word_length': 3.7079556898288017, 'pattern_counts': {'":': 5, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3691376', 'n_tokens_mistral': 2067, 'n_tokens_neox': 1740, 'n_words': 233}