Bläddra i källkod

Merge branch 'twofactor' of https://github.com/manqala/frappe into twofactor

version-14
crossxcell99 8 år sedan
förälder
incheckning
b348027a17
3 ändrade filer med 44 tillägg och 1 borttagningar
  1. +30
    -0
      frappe/desk/page/setup_wizard/setup_wizard.js
  2. +12
    -1
      frappe/desk/page/setup_wizard/setup_wizard.py
  3. +2
    -0
      frappe/hooks.py

+ 30
- 0
frappe/desk/page/setup_wizard/setup_wizard.js Visa fil

@@ -563,6 +563,36 @@ var frappe_slides = [
}
},
},
{
//Two Factor Select
name:'twofactor',
domains: ["all"],
title: __("Two Factor Authentication"),
icon: "fa fa-flag",
help: __("Setup Two Factor Authentication For Users"),
fields: [
{ fieldname: "twofactor_enable", label: __("Enable Two Factor Authentication"),
fieldtype: "Check"},
{ fieldtype: "Section Break" },
{ fieldname: "twofactor_method", label: __("Select Authentication Method"),
fieldtype: "Select"}
],
onload:function(slide){
slide.form.fields_dict.twofactor_method.df.options = ['SMS','Email','OTP App']
slide.form.fields_dict.twofactor_method.$wrapper.css('display','none');
slide.get_input('twofactor_enable').change(function(){
slide.form.fields_dict.twofactor_method.$wrapper.toggle();
if(this.checked){
slide.form.fields_dict.twofactor_method.df.reqd = 1;
}
else{
slide.form.fields_dict.twofactor_method.df.reqd = 0;
}
slide.form.fields_dict.twofactor_method.refresh();
});
}

}
];

var utils = {


+ 12
- 1
frappe/desk/page/setup_wizard/setup_wizard.py Visa fil

@@ -76,8 +76,12 @@ def update_system_settings(args):
'date_format': frappe.db.get_value("Country", args.get("country"), "date_format"),
'number_format': number_format,
'enable_scheduler': 1 if not frappe.flags.in_test else 0,
'backup_limit': 3 # Default for downloadable backups
'backup_limit': 3, # Default for downloadable backups
'enable_two_factor_auth':args.get("twofactor_enable"),
'two_factor_method':args.get('twofactor_method')
})
if args.get("twofactor_enable") == 1:
enable_twofactor_all_roles()
system_settings.save()

def update_user_name(args):
@@ -267,3 +271,10 @@ def email_setup_wizard_exception(traceback, args):

def get_language_code(lang):
return frappe.db.get_value('Language', {'language_name':lang})


def enable_twofactor_all_roles():
all_role = frappe.get_doc('Role',{'role_name':'All'})
all_role.two_factor_auth = True
all_role.save(ignore_permissions=True)


+ 2
- 0
frappe/hooks.py Visa fil

@@ -190,3 +190,5 @@ bot_parsers = [

setup_wizard_exception = "frappe.desk.page.setup_wizard.setup_wizard.email_setup_wizard_exception"
before_write_file = "frappe.limits.validate_space_limit"

otp_methods = ['OTP App','Email','SMS']

Laddar…
Avbryt
Spara