Merge pull request #596 from anandpdoshi/hotfix

Disable Print Format, Fixed gravatar, Background Style, ask Admin password
This commit is contained in:
Nabin Hait 2014-06-10 16:51:54 +05:30
commit 1d321704ae
17 changed files with 466 additions and 428 deletions

View file

@ -205,7 +205,7 @@ def setup_utilities(parser):
help="Create new conf.py file")
parser.add_argument("--make_custom_server_script", nargs=1, metavar="DOCTYPE",
help="Create new conf.py file")
parser.add_argument("--set_admin_password", metavar='ADMIN-PASSWORD', nargs=1,
parser.add_argument("--set_admin_password", metavar='ADMIN-PASSWORD', nargs="*",
help="Set administrator password")
parser.add_argument("--request", metavar='URL-ARGS', nargs=1, help="Run request as admin")
parser.add_argument("--mysql", action="store_true", help="get mysql shell for a site")
@ -729,8 +729,13 @@ def checkout(branch):
git(("checkout", branch))
@cmd
def set_admin_password(admin_password):
def set_admin_password(admin_password=None):
import frappe
import getpass
while not admin_password:
admin_password = getpass.getpass("Administrator's password: ")
frappe.connect()
frappe.db.sql("""update __Auth set `password`=password(%s)
where user='Administrator'""", (admin_password,))

View file

@ -47,7 +47,7 @@ class TestCustomizeForm(unittest.TestCase):
d = self.get_customize_form("User")
self.assertEquals(d.doc_type, "User")
self.assertEquals(len(d.get("customize_form_fields")), 54)
self.assertEquals(len(d.get("customize_form_fields")), 55)
self.assertEquals(d.get("customize_form_fields")[-1].fieldname, "test_custom_field")
self.assertEquals(d.get("customize_form_fields", {"fieldname": "location"})[0].in_list_view, 1)

View file

@ -11,7 +11,7 @@ from frappe.model.document import Document
class OutgoingEmailSettings(Document):
def validate(self):
if self.mail_server:
if self.mail_server and not frappe.local.flags.in_patch:
from frappe.utils import cint
from frappe.utils.email_lib.smtp import SMTPServer
smtpserver = SMTPServer(login = self.mail_login,

View file

@ -70,6 +70,12 @@
"options": "Client\nServer",
"permlevel": 0
},
{
"fieldname": "disabled",
"fieldtype": "Check",
"label": "Disabled",
"permlevel": 0
},
{
"fieldname": "section_break_6",
"fieldtype": "Section Break",
@ -103,7 +109,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2014-05-09 02:12:39.540952",
"modified": "2014-06-10 04:44:45.823803",
"modified_by": "Administrator",
"module": "Core",
"name": "Print Format",

View file

@ -3,6 +3,7 @@
from __future__ import unicode_literals
import frappe, os
from frappe import _
import frappe.utils
from frappe.modules import get_doc_path
@ -85,9 +86,16 @@ def get_print_format_name(doctype, format_name):
if format_name==standard_format:
return format_name
opts = frappe.db.get_value("Print Format", format_name, "disabled", as_dict=True)
if not opts:
frappe.throw(_("Print Format {0} does not exist").format(format_name), frappe.DoesNotExistError)
elif opts.disabled:
frappe.throw(_("Print Format {0} is disabled").format(format_name), frappe.DoesNotExistError)
# server, find template
path = os.path.join(get_doc_path(frappe.db.get_value("DocType", doctype, "module"),
"Print Format", format_name), format_name + ".html")
if os.path.exists(path):
with open(path, "r") as pffile:
return pffile.read()

View file

@ -1,511 +1,522 @@
{
"allow_attach": 1,
"allow_copy": 0,
"allow_import": 1,
"allow_rename": 1,
"creation": "2014-03-11 14:55:00",
"description": "Represents a User in the system.",
"docstatus": 0,
"doctype": "DocType",
"document_type": "Master",
"allow_attach": 1,
"allow_copy": 0,
"allow_import": 1,
"allow_rename": 1,
"creation": "2014-03-11 14:55:00",
"description": "Represents a User in the system.",
"docstatus": 0,
"doctype": "DocType",
"document_type": "Master",
"fields": [
{
"fieldname": "sb0_5",
"fieldtype": "Section Break",
"label": "Personal Info",
"fieldname": "sb0_5",
"fieldtype": "Section Break",
"label": "Personal Info",
"permlevel": 0
},
},
{
"default": "1",
"fieldname": "enabled",
"fieldtype": "Check",
"in_list_view": 1,
"label": "Enabled",
"no_copy": 0,
"oldfieldname": "enabled",
"oldfieldtype": "Check",
"permlevel": 0,
"default": "1",
"fieldname": "enabled",
"fieldtype": "Check",
"in_list_view": 1,
"label": "Enabled",
"no_copy": 0,
"oldfieldname": "enabled",
"oldfieldtype": "Check",
"permlevel": 0,
"read_only": 1
},
},
{
"fieldname": "unsubscribed",
"fieldtype": "Check",
"hidden": 1,
"label": "Unsubscribed",
"no_copy": 1,
"fieldname": "unsubscribed",
"fieldtype": "Check",
"hidden": 1,
"label": "Unsubscribed",
"no_copy": 1,
"permlevel": 0
},
},
{
"fieldname": "email",
"fieldtype": "Data",
"hidden": 0,
"label": "Email",
"no_copy": 1,
"oldfieldname": "email",
"oldfieldtype": "Data",
"permlevel": 0,
"reqd": 1,
"fieldname": "email",
"fieldtype": "Data",
"hidden": 0,
"label": "Email",
"no_copy": 1,
"oldfieldname": "email",
"oldfieldtype": "Data",
"permlevel": 0,
"reqd": 1,
"search_index": 0
},
},
{
"fieldname": "first_name",
"fieldtype": "Data",
"in_list_view": 1,
"label": "First Name",
"no_copy": 0,
"oldfieldname": "first_name",
"oldfieldtype": "Data",
"permlevel": 0,
"fieldname": "first_name",
"fieldtype": "Data",
"in_list_view": 1,
"label": "First Name",
"no_copy": 0,
"oldfieldname": "first_name",
"oldfieldtype": "Data",
"permlevel": 0,
"reqd": 1
},
},
{
"fieldname": "middle_name",
"fieldtype": "Data",
"label": "Middle Name (Optional)",
"no_copy": 0,
"oldfieldname": "middle_name",
"oldfieldtype": "Data",
"fieldname": "middle_name",
"fieldtype": "Data",
"label": "Middle Name (Optional)",
"no_copy": 0,
"oldfieldname": "middle_name",
"oldfieldtype": "Data",
"permlevel": 0
},
},
{
"fieldname": "last_name",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Last Name",
"oldfieldname": "last_name",
"oldfieldtype": "Data",
"fieldname": "last_name",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Last Name",
"oldfieldname": "last_name",
"oldfieldtype": "Data",
"permlevel": 0
},
},
{
"fieldname": "column_break0",
"fieldtype": "Column Break",
"oldfieldtype": "Column Break",
"permlevel": 0,
"print_width": "50%",
"fieldname": "column_break0",
"fieldtype": "Column Break",
"oldfieldtype": "Column Break",
"permlevel": 0,
"print_width": "50%",
"width": "50%"
},
},
{
"description": "Language preference for user interface (only if available).",
"fieldname": "language",
"fieldtype": "Select",
"label": "Language",
"options": "Loading...",
"description": "Language preference for user interface (only if available).",
"fieldname": "language",
"fieldtype": "Select",
"label": "Language",
"options": "Loading...",
"permlevel": 0
},
},
{
"description": "Default is system timezone",
"fieldname": "time_zone",
"fieldtype": "Select",
"label": "Timezone",
"description": "Default is system timezone",
"fieldname": "time_zone",
"fieldtype": "Select",
"label": "Timezone",
"permlevel": 0
},
},
{
"fieldname": "change_password",
"fieldtype": "Section Break",
"label": "Set Password",
"fieldname": "change_password",
"fieldtype": "Section Break",
"label": "Set Password",
"permlevel": 0
},
},
{
"fieldname": "new_password",
"fieldtype": "Password",
"label": "New Password",
"no_copy": 1,
"fieldname": "new_password",
"fieldtype": "Password",
"label": "New Password",
"no_copy": 1,
"permlevel": 0
},
},
{
"fieldname": "reset_password_key",
"fieldtype": "Data",
"hidden": 1,
"label": "Reset Password Key",
"no_copy": 1,
"permlevel": 0,
"print_hide": 1,
"fieldname": "reset_password_key",
"fieldtype": "Data",
"hidden": 1,
"label": "Reset Password Key",
"no_copy": 1,
"permlevel": 0,
"print_hide": 1,
"read_only": 1
},
},
{
"depends_on": "eval:!doc.__islocal",
"fieldname": "display_settings",
"fieldtype": "Section Break",
"label": "Display Settings",
"depends_on": "eval:!doc.__islocal",
"fieldname": "display_settings",
"fieldtype": "Section Break",
"label": "Display Settings",
"permlevel": 0
},
},
{
"description": "Get your globally recognized avatar from <a href=\"https://gravatar.com/\">Gravatar.com</a>",
"fieldname": "user_image",
"fieldtype": "Attach",
"hidden": 0,
"label": "User Image",
"no_copy": 1,
"description": "Get your globally recognized avatar from <a href=\"https://gravatar.com/\">Gravatar.com</a>",
"fieldname": "user_image",
"fieldtype": "Attach",
"hidden": 0,
"label": "User Image",
"no_copy": 1,
"permlevel": 0
},
},
{
"fieldname": "background_image",
"fieldtype": "Attach",
"hidden": 0,
"label": "Background Image",
"no_copy": 1,
"fieldname": "background_image",
"fieldtype": "Attach",
"hidden": 0,
"label": "Background Image",
"no_copy": 1,
"permlevel": 0
},
},
{
"fieldname": "cb21",
"fieldtype": "Column Break",
"default": "Fill Screen",
"fieldname": "background_style",
"fieldtype": "Select",
"label": "Background Style",
"options": "Fill Screen\nTile",
"permlevel": 0
},
},
{
"fieldname": "user_image_show",
"fieldtype": "Image",
"label": "user_image_show",
"options": "user_image",
"fieldname": "cb21",
"fieldtype": "Column Break",
"permlevel": 0
},
},
{
"fieldname": "short_bio",
"fieldtype": "Section Break",
"label": "Short Bio",
"fieldname": "user_image_show",
"fieldtype": "Image",
"label": "user_image_show",
"options": "user_image",
"permlevel": 0
},
},
{
"fieldname": "gender",
"fieldtype": "Select",
"label": "Gender",
"oldfieldname": "gender",
"oldfieldtype": "Select",
"options": "\nMale\nFemale\nOther",
"permlevel": 0,
"fieldname": "short_bio",
"fieldtype": "Section Break",
"label": "Short Bio",
"permlevel": 0
},
{
"fieldname": "gender",
"fieldtype": "Select",
"label": "Gender",
"oldfieldname": "gender",
"oldfieldtype": "Select",
"options": "\nMale\nFemale\nOther",
"permlevel": 0,
"search_index": 0
},
},
{
"fieldname": "birth_date",
"fieldtype": "Date",
"label": "Birth Date",
"no_copy": 1,
"oldfieldname": "birth_date",
"oldfieldtype": "Date",
"fieldname": "birth_date",
"fieldtype": "Date",
"label": "Birth Date",
"no_copy": 1,
"oldfieldname": "birth_date",
"oldfieldtype": "Date",
"permlevel": 0
},
},
{
"fieldname": "location",
"fieldtype": "Data",
"label": "Location",
"no_copy": 1,
"fieldname": "location",
"fieldtype": "Data",
"label": "Location",
"no_copy": 1,
"permlevel": 0
},
},
{
"fieldname": "column_break_22",
"fieldtype": "Column Break",
"fieldname": "column_break_22",
"fieldtype": "Column Break",
"permlevel": 0
},
},
{
"fieldname": "bio",
"fieldtype": "Small Text",
"label": "Bio",
"no_copy": 1,
"permlevel": 0,
"fieldname": "bio",
"fieldtype": "Small Text",
"label": "Bio",
"no_copy": 1,
"permlevel": 0,
"set_only_once": 0
},
},
{
"description": "Check / Uncheck roles assigned to the User. Click on the Role to find out what permissions that Role has.",
"fieldname": "sb1",
"fieldtype": "Section Break",
"label": "Roles",
"permlevel": 1,
"description": "Check / Uncheck roles assigned to the User. Click on the Role to find out what permissions that Role has.",
"fieldname": "sb1",
"fieldtype": "Section Break",
"label": "Roles",
"permlevel": 1,
"read_only": 1
},
},
{
"fieldname": "roles_html",
"fieldtype": "HTML",
"label": "Roles HTML",
"permlevel": 0,
"fieldname": "roles_html",
"fieldtype": "HTML",
"label": "Roles HTML",
"permlevel": 0,
"read_only": 1
},
},
{
"fieldname": "incoming_email_settings",
"fieldtype": "Section Break",
"label": "Email Settings",
"fieldname": "incoming_email_settings",
"fieldtype": "Section Break",
"label": "Email Settings",
"permlevel": 1
},
},
{
"fieldname": "cb18",
"fieldtype": "Column Break",
"fieldname": "cb18",
"fieldtype": "Column Break",
"permlevel": 0
},
},
{
"fieldname": "email_signature",
"fieldtype": "Small Text",
"label": "Email Signature",
"no_copy": 1,
"fieldname": "email_signature",
"fieldtype": "Small Text",
"label": "Email Signature",
"no_copy": 1,
"permlevel": 0
},
},
{
"fieldname": "cb20",
"fieldtype": "Column Break",
"fieldname": "cb20",
"fieldtype": "Column Break",
"permlevel": 0
},
},
{
"description": "Pull Emails from the Inbox and attach them as Communication records (for known contacts).",
"fieldname": "sync_inbox",
"fieldtype": "Check",
"hidden": 1,
"label": "Sync Inbox",
"no_copy": 1,
"description": "Pull Emails from the Inbox and attach them as Communication records (for known contacts).",
"fieldname": "sync_inbox",
"fieldtype": "Check",
"hidden": 1,
"label": "Sync Inbox",
"no_copy": 1,
"permlevel": 0
},
},
{
"description": "POP3 Mail Server (e.g. pop.gmail.com)",
"fieldname": "email_host",
"fieldtype": "Data",
"hidden": 1,
"label": "Email Host",
"no_copy": 1,
"description": "POP3 Mail Server (e.g. pop.gmail.com)",
"fieldname": "email_host",
"fieldtype": "Data",
"hidden": 1,
"label": "Email Host",
"no_copy": 1,
"permlevel": 0
},
},
{
"fieldname": "email_use_ssl",
"fieldtype": "Check",
"hidden": 1,
"label": "Email Use SSL",
"no_copy": 1,
"fieldname": "email_use_ssl",
"fieldtype": "Check",
"hidden": 1,
"label": "Email Use SSL",
"no_copy": 1,
"permlevel": 0
},
},
{
"fieldname": "email_login",
"fieldtype": "Data",
"hidden": 1,
"label": "Email Login",
"no_copy": 1,
"fieldname": "email_login",
"fieldtype": "Data",
"hidden": 1,
"label": "Email Login",
"no_copy": 1,
"permlevel": 0
},
},
{
"fieldname": "email_password",
"fieldtype": "Password",
"hidden": 1,
"label": "Email Password",
"no_copy": 1,
"fieldname": "email_password",
"fieldtype": "Password",
"hidden": 1,
"label": "Email Password",
"no_copy": 1,
"permlevel": 0
},
},
{
"description": "These values will be automatically updated in transactions and also will be useful to restrict permissions for this user on transactions containing these values.",
"fieldname": "sb2",
"fieldtype": "Section Break",
"hidden": 1,
"label": "Defaults",
"oldfieldtype": "Column Break",
"permlevel": 1,
"print_width": "50%",
"read_only": 1,
"description": "These values will be automatically updated in transactions and also will be useful to restrict permissions for this user on transactions containing these values.",
"fieldname": "sb2",
"fieldtype": "Section Break",
"hidden": 1,
"label": "Defaults",
"oldfieldtype": "Column Break",
"permlevel": 1,
"print_width": "50%",
"read_only": 1,
"width": "50%"
},
},
{
"description": "Enter default value fields (keys) and values. If you add multiple values for a field, the first one will be picked. These defaults are also used to set \"match\" permission rules. To see list of fields, go to <a href=\"#Form/Customize Form/Customize Form\">Customize Form</a>.",
"fieldname": "defaults",
"fieldtype": "Table",
"hidden": 1,
"label": "User Defaults",
"no_copy": 1,
"options": "DefaultValue",
"description": "Enter default value fields (keys) and values. If you add multiple values for a field, the first one will be picked. These defaults are also used to set \"match\" permission rules. To see list of fields, go to <a href=\"#Form/Customize Form/Customize Form\">Customize Form</a>.",
"fieldname": "defaults",
"fieldtype": "Table",
"hidden": 1,
"label": "User Defaults",
"no_copy": 1,
"options": "DefaultValue",
"permlevel": 0
},
},
{
"fieldname": "sb3",
"fieldtype": "Section Break",
"label": "Security Settings",
"oldfieldtype": "Section Break",
"permlevel": 0,
"fieldname": "sb3",
"fieldtype": "Section Break",
"label": "Security Settings",
"oldfieldtype": "Section Break",
"permlevel": 0,
"read_only": 1
},
},
{
"default": "System User",
"description": "User Type \"System User\" can access Desktop. \"Website User\" can only be logged into the website and portal pages. ",
"fieldname": "user_type",
"fieldtype": "Select",
"label": "User Type",
"oldfieldname": "user_type",
"oldfieldtype": "Select",
"options": "System User\nWebsite User",
"permlevel": 0,
"read_only": 1,
"default": "System User",
"description": "User Type \"System User\" can access Desktop. \"Website User\" can only be logged into the website and portal pages. ",
"fieldname": "user_type",
"fieldtype": "Select",
"label": "User Type",
"oldfieldname": "user_type",
"oldfieldtype": "Select",
"options": "System User\nWebsite User",
"permlevel": 0,
"read_only": 1,
"reqd": 1
},
},
{
"description": "Allow user to login only after this hour (0-24)",
"fieldname": "login_after",
"fieldtype": "Int",
"label": "Login After",
"permlevel": 0,
"description": "Allow user to login only after this hour (0-24)",
"fieldname": "login_after",
"fieldtype": "Int",
"label": "Login After",
"permlevel": 0,
"read_only": 1
},
},
{
"description": "Allow user to login only before this hour (0-24)",
"fieldname": "login_before",
"fieldtype": "Int",
"label": "Login Before",
"permlevel": 0,
"description": "Allow user to login only before this hour (0-24)",
"fieldname": "login_before",
"fieldtype": "Int",
"label": "Login Before",
"permlevel": 0,
"read_only": 1
},
},
{
"description": "Restrict user from this IP address only. Multiple IP addresses can be added by separating with commas. Also accepts partial IP addresses like (111.111.111)",
"fieldname": "restrict_ip",
"fieldtype": "Data",
"label": "Restrict IP",
"permlevel": 0,
"description": "Restrict user from this IP address only. Multiple IP addresses can be added by separating with commas. Also accepts partial IP addresses like (111.111.111)",
"fieldname": "restrict_ip",
"fieldtype": "Data",
"label": "Restrict IP",
"permlevel": 0,
"read_only": 1
},
},
{
"fieldname": "column_break1",
"fieldtype": "Column Break",
"oldfieldtype": "Column Break",
"permlevel": 0,
"print_width": "50%",
"fieldname": "column_break1",
"fieldtype": "Column Break",
"oldfieldtype": "Column Break",
"permlevel": 0,
"print_width": "50%",
"width": "50%"
},
},
{
"fieldname": "last_login",
"fieldtype": "Read Only",
"hidden": 0,
"label": "Last Login",
"no_copy": 1,
"oldfieldname": "last_login",
"oldfieldtype": "Read Only",
"permlevel": 0,
"read_only": 1,
"reqd": 0,
"fieldname": "last_login",
"fieldtype": "Read Only",
"hidden": 0,
"label": "Last Login",
"no_copy": 1,
"oldfieldname": "last_login",
"oldfieldtype": "Read Only",
"permlevel": 0,
"read_only": 1,
"reqd": 0,
"search_index": 0
},
},
{
"fieldname": "last_ip",
"fieldtype": "Read Only",
"label": "Last IP",
"no_copy": 1,
"oldfieldname": "last_ip",
"oldfieldtype": "Read Only",
"permlevel": 0,
"fieldname": "last_ip",
"fieldtype": "Read Only",
"label": "Last IP",
"no_copy": 1,
"oldfieldname": "last_ip",
"oldfieldtype": "Read Only",
"permlevel": 0,
"read_only": 1
},
},
{
"fieldname": "roles_assigned_to_user",
"fieldtype": "Section Break",
"hidden": 1,
"label": "Roles Assigned To User",
"no_copy": 0,
"permlevel": 0,
"print_hide": 1,
"fieldname": "roles_assigned_to_user",
"fieldtype": "Section Break",
"hidden": 1,
"label": "Roles Assigned To User",
"no_copy": 0,
"permlevel": 0,
"print_hide": 1,
"read_only": 1
},
},
{
"fieldname": "user_roles",
"fieldtype": "Table",
"hidden": 1,
"label": "Roles Assigned",
"options": "UserRole",
"permlevel": 0,
"print_hide": 1,
"fieldname": "user_roles",
"fieldtype": "Table",
"hidden": 1,
"label": "Roles Assigned",
"options": "UserRole",
"permlevel": 0,
"print_hide": 1,
"read_only": 1
},
},
{
"fieldname": "third_party_authentication",
"fieldtype": "Section Break",
"label": "Third Party Authentication",
"fieldname": "third_party_authentication",
"fieldtype": "Section Break",
"label": "Third Party Authentication",
"permlevel": 0
},
},
{
"fieldname": "fb_username",
"fieldtype": "Data",
"label": "Facebook Username",
"no_copy": 1,
"permlevel": 0,
"fieldname": "fb_username",
"fieldtype": "Data",
"label": "Facebook Username",
"no_copy": 1,
"permlevel": 0,
"read_only": 1
},
},
{
"fieldname": "fb_userid",
"fieldtype": "Data",
"label": "Facebook User ID",
"no_copy": 1,
"permlevel": 0,
"fieldname": "fb_userid",
"fieldtype": "Data",
"label": "Facebook User ID",
"no_copy": 1,
"permlevel": 0,
"read_only": 1
},
},
{
"fieldname": "google_userid",
"fieldtype": "Data",
"label": "Google User ID",
"no_copy": 1,
"permlevel": 0,
"fieldname": "google_userid",
"fieldtype": "Data",
"label": "Google User ID",
"no_copy": 1,
"permlevel": 0,
"read_only": 1
},
},
{
"fieldname": "github_userid",
"fieldtype": "Data",
"label": "Github User ID",
"no_copy": 1,
"permlevel": 0,
"fieldname": "github_userid",
"fieldtype": "Data",
"label": "Github User ID",
"no_copy": 1,
"permlevel": 0,
"read_only": 1
},
},
{
"fieldname": "github_username",
"fieldtype": "Data",
"label": "Github Username",
"no_copy": 1,
"permlevel": 0,
"fieldname": "github_username",
"fieldtype": "Data",
"label": "Github Username",
"no_copy": 1,
"permlevel": 0,
"read_only": 1
}
],
"hide_heading": 0,
"hide_toolbar": 0,
"icon": "icon-user",
"idx": 1,
"issingle": 0,
"istable": 0,
"max_attachments": 5,
"modified": "2014-06-03 05:10:31.705621",
"modified_by": "Administrator",
"module": "Core",
"name": "User",
"owner": "Administrator",
],
"hide_heading": 0,
"hide_toolbar": 0,
"icon": "icon-user",
"idx": 1,
"issingle": 0,
"istable": 0,
"max_attachments": 5,
"modified": "2014-06-10 03:48:14.706370",
"modified_by": "Administrator",
"module": "Core",
"name": "User",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 0,
"email": 1,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"submit": 0,
"create": 1,
"delete": 0,
"email": 1,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"submit": 0,
"write": 1
},
},
{
"apply_user_permissions": 1,
"permlevel": 0,
"read": 1,
"role": "All",
"write": 1
},
{
"apply_user_permissions": 0,
"create": 0,
"delete": 0,
"email": 0,
"permlevel": 0,
"print": 0,
"read": 1,
"report": 0,
"role": "All",
"submit": 0,
"apply_user_permissions": 1,
"cancel": 0,
"create": 0,
"permlevel": 0,
"read": 1,
"role": "All",
"write": 0
},
},
{
"amend": 0,
"cancel": 0,
"create": 0,
"delete": 0,
"permlevel": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"submit": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 0,
"delete": 0,
"email": 0,
"permlevel": 0,
"print": 0,
"read": 1,
"report": 0,
"role": "All",
"submit": 0,
"write": 0
},
{
"amend": 0,
"cancel": 0,
"create": 0,
"delete": 0,
"permlevel": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"submit": 0,
"write": 1
}
],
"read_only": 0,
],
"read_only": 0,
"search_fields": "first_name, last_name"
}
}

View file

@ -27,6 +27,9 @@ def delete_doc(doctype=None, name=None, force=0, ignore_doctypes=None, for_reloa
if not frappe.db.exists(doctype, name):
return
# delete attachments
remove_all(doctype, name)
if doctype=="DocType":
if not for_reload:
frappe.db.sql("delete from `tabCustom Field` where dt = %s", name)
@ -48,9 +51,6 @@ def delete_doc(doctype=None, name=None, force=0, ignore_doctypes=None, for_reloa
delete_from_table(doctype, name, ignore_doctypes, doc)
# delete attachments
remove_all(doctype, name)
# delete user_permissions
frappe.defaults.clear_default(parenttype="User Permission", key=doctype, value=name)

View file

@ -4,7 +4,7 @@
from __future__ import unicode_literals
import frappe, os, json
from frappe.modules import scrub, get_module_path, scrub_dt_dn
from frappe.modules import get_module_path, scrub_dt_dn
from frappe.utils import get_datetime_str
def import_files(module, dt=None, dn=None, force=False):
@ -74,6 +74,7 @@ def read_doc_from_file(path):
ignore_values = {
"Report": ["disabled"],
"Print Format": ["disabled"]
}
ignore_doctypes = ["Page Role", "DocPerm"]

View file

@ -73,7 +73,8 @@ frappe.Application = Class.extend({
},
set_user_display_settings: function() {
frappe.ui.set_user_background(frappe.boot.user.background_image);
frappe.ui.set_user_background(frappe.boot.user.background_image, null,
frappe.boot.user.background_style);
},
load_bootinfo: function() {

View file

@ -44,7 +44,7 @@ frappe.ui.form.Comments = Class.extend({
} else {
c["delete"] = "";
}
c.image = frappe.user_info(c.comment_by).image;
c.image = frappe.user_info(c.comment_by).image || frappe.get_gravatar(c.comment_by);
c.comment_on = dateutil.comment_when(c.creation);
c.fullname = frappe.user_info(c.comment_by).fullname;
c.comment = frappe.markdown(c.comment);

View file

@ -6,9 +6,10 @@
frappe.user_info = function(uid) {
if(!uid)
uid = user;
if(!frappe.boot.user_info)
return {fullname:"Unknown"};
return frappe.boot.user_info[uid] || {};
if(!(frappe.boot.user_info && frappe.boot.user_info[uid])) {
return {fullname: toTitle(uid.split("@")[0]) || "Unknown"};
}
return frappe.boot.user_info[uid];
}
frappe.avatar = function(user, large, title) {
@ -28,19 +29,21 @@ frappe.gravatars = {};
frappe.get_gravatar = function(email_id) {
frappe.require("/assets/frappe/js/lib/md5.min.js");
if(!frappe.gravatars[email_id]) {
frappe.gravatars[email_id] = "https://secure.gravatar.com/avatar/" + md5(email_id)
frappe.gravatars[email_id] = "https://secure.gravatar.com/avatar/" + md5(email_id) + "?d=retro";
}
return frappe.gravatars[email_id];
}
frappe.ui.set_user_background = function(src, selector) {
frappe.ui.set_user_background = function(src, selector, style) {
if(!selector) selector = "body";
if(!style) style = "Fill Screen";
if(!src) src = "assets/frappe/images/ui/random-polygons.jpg";
frappe.dom.set_style(repl('%(selector)s { \
background: url("%(src)s") center center;\
background-attachment: fixed; \
background-size: 100%; \
}', {src:src, selector:selector}))
%(style)s \
}', {src:src, selector:selector, style: style==="Fill Screen" ? "background-size: cover;" : ""}));
}
frappe.provide('frappe.user');

View file

@ -4,7 +4,7 @@
<div class="login-content container" style="max-width: 800px;">
<form class="form-signin form-login" role="form">
<h2 class="form-signin-heading">{{ _("Login") }}</h2>
<input type="text" id="login_email"
<input type="text" id="login_email"
class="form-control" placeholder="{{ _('Email address') }}" required autofocus>
<input type="password" id="login_password"
class="form-control" placeholder="{{ _('Password') }}" required>
@ -20,30 +20,32 @@
<a href="{{ facebook_login }}" class="btn btn-lg btn-block btn-primary btn-facebook">
<i class="icon-facebook-sign"></i> {{ _("Facebook") }}</a>
{%- endif -%}
{%- if google_login is defined %}
<a href="{{ google_login }}" class="btn btn-lg btn-block btn-primary btn-google">
<i class="icon-google-plus-sign"></i> {{ _("Google") }}</a>
{%- endif -%}
{%- if github_login is defined %}
<a href="{{ github_login }}" class="btn btn-lg btn-block btn-primary btn-github">
<i class="icon-github-sign"></i> {{ _("GitHub") }}</a>
{%- endif -%}
</p>
{%- endif -%}
{%- if not disable_signup -%}
<p class="text-center">
<br><a href="#signup">{{ _("Not a user yet? Sign up") }}</a>
</p>
{%- endif -%}
<p class="text-center">
<br><a href="#forgot" class="text-muted">{{ _("Forgot Password?") }}</a>
</p>
</form>
<form class="form-signin form-signup" role="form">
<h2 class="form-signin-heading">{{ _("Sign Up") }}</h2>
<input type="text" id="signup_fullname"
<input type="text" id="signup_fullname"
class="form-control" placeholder="{{ _('Full Name') }}" required autofocus>
<input type="email" id="signup_email"
class="form-control" placeholder="{{ _('Email Id') }}" required>
@ -53,10 +55,10 @@
</p>
</form>
<form class="form-signin form-forgot" role="form">
<h2 class="form-signin-heading">{{ _("Forgot Password") }}</h2>
<input type="email" id="forgot_email"
<input type="email" id="forgot_email"
class="form-control" placeholder="{{ _('Email Id') }}" required autofocus>
<br>
<button class="btn btn-lg btn-primary btn-block btn-forgot" type="submit">{{ _("Send Password") }}</button>
@ -65,10 +67,10 @@
</p>
</form>
</div>
{% endblock %}
{% block script_lib %}{% include "templates/includes/login.js" %}{% endblock %}
{% block sidebar %}{% endblock %}
{% block sidebar %}{% endblock %}

View file

@ -12,6 +12,7 @@ no_cache = True
def get_context(context):
# get settings from site config
context["title"] = "Login"
context["disable_signup"] = frappe.utils.cint(frappe.db.get_value("Website Settings", "Website Settings", "disable_signup"))
for provider in ("google", "github", "facebook"):
if get_oauth_keys(provider):

View file

@ -148,7 +148,7 @@ class User:
def load_user(self):
d = frappe.db.sql("""select email, first_name, last_name, time_zone,
email_signature, background_image, user_type, language
email_signature, background_image, background_style, user_type, language
from tabUser where name = %s""", (self.name,), as_dict=1)[0]
if not self.can_read:

View file

@ -11,8 +11,9 @@ cur_frm.cscript.refresh = function(doc) {
});
}
cur_frm.appframe.add_button("View In Website", function() {
window.open(doc.__onload.website_route);
}, "icon-globe");
if (!doc.__islocal && doc.published) {
cur_frm.set_intro(__("Published on website at: {0}",
[repl('<a href="/%(website_route)s" target="_blank">/%(website_route)s</a>', doc.__onload)]));
}
}
}

View file

@ -18,10 +18,9 @@ $.extend(cur_frm.cscript, {
},
refresh: function(doc) {
cur_frm.cscript.layout(doc);
if(!doc.__islocal && doc.published) {
cur_frm.appframe.add_button("View In Website", function() {
window.open(doc.__onload.website_route);
}, "icon-globe");
if (!doc.__islocal && doc.published) {
cur_frm.set_intro(__("Published on website at: {0}",
[repl('<a href="/%(website_route)s" target="_blank">/%(website_route)s</a>', doc.__onload)]));
}
},
insert_style: function(doc) {

View file

@ -128,7 +128,7 @@ class FormMeta(Meta):
def load_print_formats(self):
print_formats = frappe.db.sql("""select * FROM `tabPrint Format`
WHERE doc_type=%s AND docstatus<2""", (self.name,), as_dict=1,
WHERE doc_type=%s AND docstatus<2 and ifnull(disabled, 0)=0""", (self.name,), as_dict=1,
update={"doctype":"Print Format"})
self.set("__print_formats", print_formats)