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


Python User.email方法代码示例

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


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

示例1: post

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import email [as 别名]
	def post(self):
		self.session[LOGIN_NEXT_PAGE_KEY] = self.URL
		roles=Role.all()
		if roles.count() == 0:
			# No roles were set up, set them up now
			adminRole = Role()
			adminRole.name=ROLE_ADMIN
			adminRole.put()
			role = Role()
			role.name=ROLE_DELIVERY_GUY
			role.put()
			role = Role()
			role.name=ROLE_COOK
			role.put()
			role = Role()
			role.name=ROLE_AGENT
			role.put()
			user = User()
			user.email = self.request.get("adminEmail")
			user.password = "[email protected]#"
			m = hashlib.md5()
			encodedString = self.request.get("adminPassword").encode('ascii', errors='replace')
			m.update(encodedString)
			user.passwordHash = str(m.hexdigest())
			user.activated = True
			user.role = adminRole
			user.put();
			template = jinja_environment.get_template('templates/setup/setupSuccess.html')
			self.printPage("Sikeres inicializálás", template.render(), True, True)
		else:
			template = jinja_environment.get_template('templates/setup/alreadySetUp.html')
			self.printPage("Korábban inicializálva", template.render(), True, True)
开发者ID:lajthabalazs,项目名称:diet-futar,代码行数:34,代码来源:siteAdmin.py

示例2: post

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import email [as 别名]
 def post(self, error_msg=None):
     email = self.request.get("email")
     username = self.request.get("username")
     users = User.all().filter('email', email)
     user = User()
     user.email = email
     user.username = username
     user.fullname = self.request.get("firstname")+" "+self.request.get("lastname")
     user.birthday = datetime.datetime.strptime(self.request.get("birthday"), '%Y-%m-%d')
     user.set_password(self.request.get("password")) #set password. need encrypt. 
     user.firstname = self.request.get("firstname")
     user.lastname = self.request.get("lastname")
     user.country = self.request.get("country")
     gender = self.request.get("gender")
     if gender:
         gender_ = str(gender)[0:1]
         user.gender = gender_
     if users.count() == 0:
         user.put()
         #init() the session
         sessions.Session().login_user(user)
         self.redirect("/")
         return
     else:
         error_msg = "That email address has already been registered."
     template_values = {
        "temp_user": user,
        "error": error_msg
     }
     self.generate('signup.html',template_values)
开发者ID:Git-Host,项目名称:cpedialog,代码行数:32,代码来源:login.py

示例3: register_post

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import email [as 别名]
def register_post():

    # Create the user object to store our data
    user = User()
    user.first_name = request.form.get('first_name')
    user.last_name = request.form.get('last_name')
    user.email = request.form.get('email')
    user.phone = request.form.get('phone')
    user.password = request.form.get('password')
    user.role = request.form.get('role')

    existing = db_session.query(User).filter_by(email=user.email).first()
    if existing:
        flash("Email already in use", "error")
        return redirect(url_for("user_login_get"))


    # Add the user object to the database
    db_session.add(user)

    # Save the user in the database
    db_session.commit()

    # # Redirect user to landing page
    return redirect(url_for("traveler_view_trip"))
开发者ID:jessjoschwartz,项目名称:Lighthouse,代码行数:27,代码来源:controller.py

示例4: import_users

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import email [as 别名]
 def import_users(self, csv):
     lines = csv.split('\n')
     for line in lines:
         if len(line.strip()) == 0:
             continue
         user = User()
         user.email = line.strip()
         user.put()
开发者ID:KlubbAlfaRomeoNorge,项目名称:members,代码行数:10,代码来源:load.py

示例5: regiest

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import email [as 别名]
def regiest():
    user = User()
    user.username = request.form['username']
    user.password=utils.getenctry(request.form['password'])
    user.email = request.form['email']
    user.adduser()
    session['username'] = user.username
    flash("Welcome, %s!" % session['username'])
    return redirect(url_for('home'))
    #return (jsonify(user=user.to_json()))
开发者ID:shixiutingfen,项目名称:sugarcoffee,代码行数:12,代码来源:views.py

示例6: adduser

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import email [as 别名]
def adduser():
    user=User()
    requeststr = request.query_string
    params=utils.getparam(unquote(requeststr))
    user.username=params['username']
    user.email=params['email']
    user.password=params['password']
    user.sex=params['sex']
    user.adduser()
    return jsonify(msg='0000')
开发者ID:shixiutingfen,项目名称:sugarcoffeeadmin,代码行数:12,代码来源:views.py

示例7: load_users

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import email [as 别名]
def load_users(session):
    with open('seed_data/u.user', 'rb') as csvfile:
        userreader = csv.reader(csvfile, delimiter = '|')
        for userrow in userreader:
            u = User() 
            u.id = userrow[0]
            u.age = userrow[1]
            u.gender = userrow[2]
            u.occupation = userrow[3]
            u.zipcode = userrow[4]
            u.email = None
            u.password = None

            session.add(u)
开发者ID:k8k,项目名称:HBRatings,代码行数:16,代码来源:seed.py

示例8: login_google_user

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import email [as 别名]
 def login_google_user(self):
     """
      associate the sesion object with google user object.
     """
     session = self.session
     google_user = users.get_current_user()
     if google_user and (session.user is None):
         users_ = User.all().filter("email", google_user.email())
         if users_.count() == 0:
             user = User()
             user.email = google_user.email()
             user.username = google_user.nickname()
             user.put()
         else:
             user = users_[0]
         self.login_user(user)
开发者ID:Git-Host,项目名称:cpedialog,代码行数:18,代码来源:sessions.py

示例9: __register

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import email [as 别名]
    def __register(self, api):
        """ Check incoming parameters and register user """
        # Validate email
        email = self.request.get(constants.VAR_NAME_EMAIL)
        logging.info('User registering: ' + str(email))
        if not User.isEmailValid(email) or User.isAlreadyRegistered(email):
            logging.error('Email mismatched or already registered')
            self.set_error(constants.STATUS_BAD_REQUEST,
                           self.gettext('REGISTER_ERROR'),
                           url=self.request.url)
            return

        # Validate password
        password = self.request.get(constants.VAR_NAME_PASSWORD)
        if not User.isPasswordValid(password):
            logging.error('Invalid password')
            self.set_error(constants.STATUS_BAD_REQUEST,
                           self.gettext('REGISTER_ERROR'),
                           url=self.request.url)
            return

        # Calculate password hash
        salt_and_key = CryptoUtil.get_salt_and_key(password)
        salt = salt_and_key[0]
        key = salt_and_key[1]

        # Create and store user object
        user = User(key_name=email)
        user.email = email.lower()
        user.salt = salt
        user.password = key
        user.verified = False
        user.put()

        # Send email for verification
        self.__send_verification(email)

        if api == '':
            # Display message
            template_values = {
                'message': self.gettext('PLEASE_CHECK_YOUR_EMAIL')
            }
            template = self.jinja2_env.get_template('staticmessage.html')
            self.response.out.write(template.render(template_values))

        self.ok()
开发者ID:szilardhuber,项目名称:shopper,代码行数:48,代码来源:userhandler.py

示例10: create_person

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import email [as 别名]
def create_person(user):
    name = request.forms.get("name")
    email = request.forms.get("email")
    serial = request.forms.get("serial")
    if not any([name, email, serial]):
        return redirect(settings.ADMIN_PATH)

    try:
        person = User.get(email=email)
    except:
        person = User()
        person.email = email
    person.name = name
    person.serial = serial
    person.is_active = True

    try:
        person.save()
    except IntegrityError:
        return redirect(settings.ADMIN_PATH)

    return redirect("{0}/{1}".format(settings.ADMIN_PATH, person.id))
开发者ID:TeachBoost,项目名称:ansible,代码行数:24,代码来源:admin.py

示例11: login_page

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import email [as 别名]
def login_page():
    email = request.form.get("email")
    password = request.form.get("password")

    email_login_query = User.query.filter_by(email=email).first()
    # check to see if email_login_query is empty
    if not email_login_query:
        # okay then, we go create a new user by populating the database
        new_user = User()
        # set the User instance's email and password (we call it new_user)
        new_user.email = email
        new_user.password = password

        # add new user to the session, database insertion
        db.session.add(new_user)
        db.session.commit()
        return redirect(url_for('index'))
    else:
        # information is already in the database
        # check to see if the username and password match what is in db
        username_password_check = User.query.filter(
                                                    and_(
                                                        User.email==email, 
                                                        User.password==password
                                                        )).first()

        if username_password_check is None:
            # want to redirect them back the the page with login form
            # flash a message
            flash('Error in login')
            return redirect(url_for('sign_up'))
        else:
            session['user_id'] = username_password_check.user_id

            # valid login credentials redirects user to home page
            flash('You were successfully logged in')

            # Redirects the user to their profile page upon login
            return redirect(url_for('user_profile', user_id=session['user_id']))
开发者ID:Munnu,项目名称:movie-ratings-project,代码行数:41,代码来源:server.py

示例12: Role

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import email [as 别名]
gbr=Image()
x=gbr.query.filter_by(path='beranda.jpeg').first()
if x is None:
    gbr.path='beranda.jpeg'
    db.session.add(gbr)
    db.session.commit()


role = Role()
x=role.query.filter_by(name='admin').first()
# db.session.delete(x)
# db.session.commit()
if x is None :
    role.name='admin'
    role.description='admin'
    db.session.add(role)
    db.session.commit()

user = User()
y=user.query.filter_by(email='[email protected]').first()
if y is None:
    user.email='[email protected]'
    user.password='123456'
    user.active=True
    user.roles.append(role)  # bagian ini yg beda
    db.session.add(user)
    db.session.commit()



开发者ID:1sfgdkiwo,项目名称:py_cms02,代码行数:29,代码来源:initializedb.py

示例13: task_user_restore

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import email [as 别名]
def task_user_restore(userlist):
    for user in userlist:
        newuser = User()
        newuser.email = user['email']
        newuser.save()
开发者ID:KlubbAlfaRomeoNorge,项目名称:members,代码行数:7,代码来源:restore.py

示例14: post

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import email [as 别名]
	def post(self):
		referer = None
		refererKey = self.request.get('refererKey')
		if refererKey != None and refererKey != "":
			referer = User.get(refererKey)
		email = self.request.get('email')
		phoneNumber = self.request.get('phoneNumber')
		password = self.request.get('password')
		passwordCheck = self.request.get('passwordCheck')
		familyName= self.request.get('familyName')
		givenName= self.request.get('givenName')
		sourceOfInfo=self.request.get('sourceOfInfo')
		user = {}
		user["email"]= email
		user["familyName"]=familyName
		user["givenName"]=givenName
		user["phoneNumber"]=phoneNumber
		user["sourceOfInfo"]=sourceOfInfo
		users = User.gql('WHERE email = :1', email)
		refererUrlPart = ""
		if referer != None:
			refererUrlPart = "?refererKey=" + str(referer.key())
		self.session[USER]=user
		if (users.count(1)>0):
			self.session[REGISTRATION_ERROR_KEY]=REGISTRATION_ERROR_EXISTING_USER
			self.redirect('/registration' + refererUrlPart)
		elif (passwordCheck != password):
			self.session[REGISTRATION_ERROR_KEY] = REGISTRATION_ERROR_PASSWORD_DOESNT_MATCH
			self.redirect('/registration' + refererUrlPart)
		elif familyName==None or familyName=="" or givenName==None or givenName=="":
			self.session[REGISTRATION_ERROR_KEY] = REGISTRATION_ERROR_USER_NAME_NOT_FILLED
			self.redirect('/registration' + refererUrlPart)
		else:
			#Everything went ok, create the user and log him in
			user = User()
			user.email = email
			user.familyName=familyName
			user.givenName=givenName
			user.password = "[email protected]#"
			m = hashlib.md5()
			encodedString = password.encode('ascii', errors='replace')
			m.update(encodedString)
			user.passwordHash = str(m.hexdigest())
			user.phoneNumber=phoneNumber
			user.activated = False
			user.registrationDate=datetime.datetime.now(timeZone)
			user.referer = referer
			user.sourceOfInfo = sourceOfInfo
			word = ''
			random = Random()
			for i in range(1,32):
				word += random.choice('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789')
			user.activationCode = word			
			user.put()
			updateUser(user)
			template_values = {
				'email':email,
				'activationCode':word,
				'user':user
			}
			messageTemplate = jinja_environment.get_template('templates/userForms/activation/activation_code.html')
			message = mail.EmailMessage(sender="Diet Futar <[email protected]>")
			message.subject="Diet-futar, sikeres regisztracio"
			message.to = email
			message.body = messageTemplate.render(template_values)
			message.send()
			self.redirect("/activationPending")
开发者ID:lajthabalazs,项目名称:diet-futar,代码行数:69,代码来源:user_forms.py


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