Guest is not a valid email id

hi ,
i changed the signup form and made new fields , everything is working great for website user , user type but my idea is to open the registration for system users through the signup button and give them specific role , still i didnt define the role but i changed the user_type to system user and when i submit the signup i get this message
"Guest is not a valid email id"

any idea ?

Can you share the customizations you did.

1 Like

yes sure my friend :smile: @neilLasrado
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();

	if(!args.email || !valid_email(args.email) || !args.first_name || !args.last_name) {
		frappe.msgprint(__("Valid email and name required"));
		return false;
	}
	login.call(args);
	return false;
});

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

statusCode: login.login_handlers @neilLasrado