Issue in guest login

create user using this,

 user_doc = frappe.get_doc({
        "doctype": "User",
        "email": email,
        "first_name": username,
        "new_password": password,
        "enabled": 1  # Enable the user
    })

with use of this code i got a error “invalidemailcreditials”

 frappe.local.login({
          "user": email,
          "password": password
      })

Thanks

Can you please give more details, I can not understand the issue.

Yes @Nasir_Khan,

I wanna create login/signup system. for that i created user with name, email, password with below code

user_doc = frappe.get_doc({
    "doctype": "User",
    "email": email,
    "first_name": username,
    "new_password": password,
    "enabled": 1  # Enable the user
})

with this user succesfully created in frappe.

after that i’m trying to login with that email and password with below code but i got error like “invalidemailcreditials”

frappe.local.login({
      "user": email,
      "password": password
  })

Thanks

use this code

from frappe.utils.password import update_password
user_doc = frappe.get_doc({
    "doctype": "User",
    "email": email,
    "first_name": username,
    "enabled": 1  # Enable the user
})
update_password(user_doc.name, password)

also you have to assign user role to be able to login into desk access.

Dosn’t work this