当前位置: 首页>>代码示例>>Python>>正文


Python Document.password方法代码示例

本文整理汇总了Python中webnotes.model.doc.Document.password方法的典型用法代码示例。如果您正苦于以下问题:Python Document.password方法的具体用法?Python Document.password怎么用?Python Document.password使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在webnotes.model.doc.Document的用法示例。


在下文中一共展示了Document.password方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: validate_incoming

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import password [as 别名]
	def validate_incoming(self):
		"""
			Checks support ticket email settings
		"""
		if self.doc.sync_support_mails and self.doc.support_host:
			from webnotes.utils.email_lib.receive import POP3Mailbox
			from webnotes.model.doc import Document
			import _socket, poplib
			
			inc_email = Document('Incoming Email Settings')
			inc_email.encode()
			inc_email.host = self.doc.support_host
			inc_email.use_ssl = self.doc.support_use_ssl
			try:
				err_msg = 'User Name or Support Password missing. Please enter and try again.'
				if not (self.doc.support_username and self.doc.support_password):
					raise AttributeError, err_msg
				inc_email.username = self.doc.support_username
				inc_email.password = self.doc.support_password
			except AttributeError, e:
				webnotes.msgprint(err_msg)
				raise e

			pop_mb = POP3Mailbox(inc_email)
			
			try:
				pop_mb.connect()
			except _socket.error, e:
				# Invalid mail server -- due to refusing connection
				webnotes.msgprint('Invalid POP3 Mail Server. Please rectify and try again.')
				raise e
开发者ID:AminfiBerlin,项目名称:erpnext,代码行数:33,代码来源:email_settings.py

示例2: create_login

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import password [as 别名]
  def create_login(self,arg):
    arg = eval(arg)
    cont_det = sql("select * from tabContact where name=%s",(arg['contact']),as_dict=1)
    if cont_det[0]['docstatus'] !=0:
      msgprint('Please save the corresponding contact first')
      raise Exception
      
    if sql("select name from tabProfile where name=%s",cont_det[0]['email_id']):
      msgprint('Profile with same name already exist.')
      raise Exception
    else:
      p = Document('Profile')
      p.name = cont_det[0]['email_id']
      p.first_name = cont_det[0]['first_name']
      p.last_name = cont_det[0]['last_name']
      p.email = cont_det[0]['email_id']
      p.cell_no = cont_det[0]['contact_no']
      p.password = 'password'
      p.enabled = 1
      p.user_type = 'Partner';
      p.save(1)
      
      get_obj(doc=p).on_update()
      
      role = []
      if cont_det[0]['contact_type'] == 'Individual':
        role = ['Customer']
      else:
        if cont_det[0]['is_customer']:
          role.append('Customer')
        if cont_det[0]['is_supplier']:
          role.append('Supplier')
        if cont_det[0]['is_sales_partner']:
          role.append('Partner')

      if role:
        prof_nm = p.name
        for i in role:
          r = Document('UserRole')
          r.parent = p.name
          r.role = i
          r.parenttype = 'Profile'
          r.parentfield = 'userroles'
          r.save(1)
        
          if i == 'Customer':
            def_keys = ['from_company','customer_name','customer']
            def_val = cont_det[0]['customer_name']
            self.set_default_val(def_keys,def_val,prof_nm)

          if i == 'Supplier':
            def_keys = ['supplier_name','supplier']
            def_val = cont_det[0]['supplier_name']
            self.set_default_val(def_keys,def_val,prof_nm)

      sql("update tabContact set has_login = 'Yes' where name=%s",cont_det[0]['name'])
      sql("update tabContact set disable_login = 'No' where name=%s",cont_det[0]['name'])
      msgprint('User login is created.')
开发者ID:alvz,项目名称:erpnext,代码行数:60,代码来源:contact_control.py

示例3: create_login

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import password [as 别名]
    def create_login(self, arg):
        arg = eval(arg)
        cont_det = sql("select * from tabContact where name=%s", (arg["contact"]), as_dict=1)
        if cont_det[0]["docstatus"] != 0:
            msgprint("Please save the corresponding contact first")
            raise Exception

        if sql("select name from tabProfile where name=%s", cont_det[0]["email_id"]):
            msgprint("Profile with same name already exist.")
            raise Exception
        else:
            p = Document("Profile")
            p.name = cont_det[0]["email_id"]
            p.first_name = cont_det[0]["first_name"]
            p.last_name = cont_det[0]["last_name"]
            p.email = cont_det[0]["email_id"]
            p.cell_no = cont_det[0]["contact_no"]
            p.password = "password"
            p.enabled = 1
            p.user_type = "Partner"
            p.save(1)

            get_obj(doc=p).on_update()

            role = []
            if cont_det[0]["contact_type"] == "Individual":
                role = ["Customer"]
            else:
                if cont_det[0]["is_customer"]:
                    role.append("Customer")
                if cont_det[0]["is_supplier"]:
                    role.append("Supplier")
                if cont_det[0]["is_sales_partner"]:
                    role.append("Partner")

            if role:
                prof_nm = p.name
                for i in role:
                    r = Document("UserRole")
                    r.parent = p.name
                    r.role = i
                    r.parenttype = "Profile"
                    r.parentfield = "userroles"
                    r.save(1)

                    if i == "Customer":
                        def_keys = ["from_company", "customer_name", "customer"]
                        def_val = cont_det[0]["customer_name"]
                        self.set_default_val(def_keys, def_val, prof_nm)

                    if i == "Supplier":
                        def_keys = ["supplier_name", "supplier"]
                        def_val = cont_det[0]["supplier_name"]
                        self.set_default_val(def_keys, def_val, prof_nm)

            sql("update tabContact set has_login = 'Yes' where name=%s", cont_det[0]["name"])
            sql("update tabContact set disable_login = 'No' where name=%s", cont_det[0]["name"])
            msgprint("User login is created.")
开发者ID:nijil,项目名称:erpnext,代码行数:60,代码来源:contact_control.py

示例4: __init__

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import password [as 别名]
	def __init__(self):
		"""
			settings_doc must contain
			use_ssl, host, username, password
		"""
		from webnotes.model.doc import Document

		# extract email settings
		self.email_settings = Document('Email Settings','Email Settings')
		
		s = Document('Support Email Settings')
		s.use_ssl = self.email_settings.support_use_ssl
		s.host = self.email_settings.support_host
		s.username = self.email_settings.support_username
		s.password = self.email_settings.support_password
		
		POP3Mailbox.__init__(self, s)
开发者ID:tobrahma,项目名称:erpnext,代码行数:19,代码来源:__init__.py

示例5: login

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import password [as 别名]
def login(api_key,username,password,_type='POST'):
   	login =[]
	loginObj = {}
   	if len(api_key)<3:
		key={}
		login.append(key)
		loginObj['status']='403'
		loginObj['error']='Invalid API Key'
		#loginObj['key']=login
		return loginObj
   	elif len(username)<3 :
		key={}
		login.append(key)
		loginObj['status']='400'
		loginObj['error']='Invalid Username'
		#loginObj['key']=login
		return loginObj 

	elif len(password)<3:
		key={}
		login.append(key)
		loginObj['status']='402'
		loginObj['error']='Invalid Password'
		#loginObj['key']=login
		return loginObj 
   	else:	
		qr="select password from __Auth where user="+username+" and password=password("+password+")"
		res=webnotes.conn.sql(qr)
		#return res
		#rg=webnotes.conn.sql("select region from `tabFranchise` where contact_email="+username+"")
		from webnotes.model.doc import Document
		import random
		import string
		char_set = string.ascii_uppercase + string.digits
		rn=''.join(random.sample(char_set*6,9))
		if res :
			rr="select auth_key from `tabauth keys` where name="+username
			rs=webnotes.conn.sql(rr)
			if rs:
				key={}
              	       		key['auth_key'] = rs[0][0]
				login.append(key)
				loginObj['status']='200'
				loginObj['key']=login
				return loginObj
			else:
				d = Document('auth keys')
				d.user_name=username[1:-1]
				d.password=password[1:-1]
				d.auth_key=''.join(random.sample(char_set*6,9))
		                d.save()
				webnotes.conn.commit()
				key={}
	                        key['auth_key'] = d.password
				login.append(key)
				loginObj['status']='200'
				loginObj['key']=login
				return loginObj
		else:
			key={}
			login.append(key)
			loginObj['status']='401'
			loginObj['error']='Incorrect User name or password '
			#loginObj['key']=login
			return loginObj
开发者ID:gangadhar-kadam,项目名称:powapp,代码行数:67,代码来源:__init__.py


注:本文中的webnotes.model.doc.Document.password方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。