Try ERPNext Buy Support Partners Foundation

Create System User through the web sign up

Hi guys
i did some customization in the frappe user for sign-up though the web , i added more fields to the form … and everything is working fine if the user type is Website User but when i define the system user it gives me Guest is not a valid email id through the sign up process here blow you can see changes i made :smile:

-------------------------------------- user.py ----------------------------------------

def sign_up(
username, id_type, id_number, first_name, last_name, email, telephone, cell_phone
):
user = frappe.db.get(“User”, {“email”: email ,
“username”:username
})
if user:
if user.disabled:
return _(“Registered but disabled.”)
else:
return _(“Already Registered”)
else:
if frappe.db.sql(""“select count(*) from tabUser where
HOUR(TIMEDIFF(CURRENT_TIMESTAMP, TIMESTAMP(modified)))=1"”")[0][0] > 200:
frappe.msgprint(“Login is closed for sometime, please check back again in an hour.”)
raise Exception, “Too Many New Users”
from frappe.utils import random_string
user = frappe.get_doc({
“doctype”:“User”,
“email”: email,
“first_name”: first_name,
“enabled”: 1,
“new_password”: random_string(10),
“user_type”: “System User”,
“username”: username,
“id_type”: id_type,
“id_number”: id_number,
“last_name”: last_name,
“telephone”: telephone,
“cell_phone”: cell_phone
})
user.flags.ignore_permissions = True
user.insert()
return _(“Registration Details Emailed.”)

---------------------------------------------------login.js-------------------------------------------
$(".form-signup").on(“submit”, function(event) {
event.preventDefault();
var args = {};
args.cmd = “frappe.core.doctype.user.user.sign_up”;
args.username = ($("#signup_username").val() || “”).trim();
args.id_type = ($("#signup_id_type option:selected").val() || “”).trim();
args.id_number = ($("#signup_id_number").val() || “”).trim();
args.first_name = ($("#signup_first_name").val() || “”).trim();
args.last_name = ($("#signup_last_name").val() || “”).trim();
args.email = ($("#signup_email").val() || “”).trim();
args.telephone = ($("#signup_telephone").val() || “”).trim();
args.cell_phone = ($("#signup_cellphone").val() || “”).trim();

indent preformatted text by 4 spaces

i reviewed Ajax an i saw in status code i get 200,401,417 status codes

statusCode: login.login_handlersindent preformatted text by 4 spaces

You need to share your code with proper code formatting. Click on the 6th icon in the post formatting toolbar.

indent preformatted text by 4 spaces