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


Python User.email方法代码示例

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


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

示例1: put

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import email [as 别名]
    def put(self):
        args = parser.parse_args()
        id = args['id']
        name = args['name']
        email = args['email']
        type = args['type']

        user = User.query.filter(User.id == id).first()
        setJSONFormat()
        if user is None:
            if type == 'force':
                user = User(name)
                user.email = email
                db.session.add(user)
                try:
                    db.session.commit()
                    return jsonify(user)
                except Exception as e:
                    return jsonify(message="Error : %s" %e)
            return jsonify(messages='User with id: %s is not exists' % id)
        else:
            if name:
                user.name = name
            if email:
                user.email = email

            try:
                db.session.commit()
                return jsonify(user)
            except Exception as e:
                return jsonify(message="Error : %s" %e)
开发者ID:tarigancana,项目名称:api_with_flask,代码行数:33,代码来源:user_api.py

示例2: post

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import email [as 别名]
	def post(self):
		fname = self.request.get("first_name")
		lname = self.request.get("last_name")
		dname = self.request.get("display_name")
		email = self.request.get("email")
		password = self.request.get("password")
		rpassword = self.request.get("password_confirmation")

		#logging.critical(email)

		if password != rpassword:
			self.error = "Password Not Match"
			self.redirect('/create/account?error='+self.error)

		user = User.get_by_id(id=email)
		logging.critical(user)

		if user:
			self.error = "Email already exists!"
			self.redirect('/create/account?error='+self.error)

		user = User(id=email)
		user.fname = fname
		user.lname = lname
		user.dname = dname
		user.email = email
		user.password = password
		user.put()
		self.logged_this_user(user)
		self.tv["user"] = True
		self.redirect('/dashboard')
开发者ID:rcasona,项目名称:pythonsample,代码行数:33,代码来源:admin.py

示例3: register

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import email [as 别名]
def register():
    from forms.registration import ProfessorRegistrationForm

    form = ProfessorRegistrationForm()
    if form.validate_on_submit():
        user = User()
        user.name = form.name.data
        user.second_name = form.second_name.data
        user.middle_name = form.middle_name.data
        user.birthday = form.birthday.data
        user.password = form.password.data
        user.email = form.email.data
        # professor = Professor()
        # professor.post = form.post.data
        # professor.academic_degree = form.academic_degree.data
        # professor.rank = form.rank.data
        # professor.cathedra_id = form.cathedra.data.id
        # professor.user = user
        db.session.add(user)
        # db.session.add(professor)
        try:
            db.session.commit()
        except Exception:
            flash('Problem with registering')
            return redirect(url_for('site.register'))
        flash('Thanks for registering')
        return redirect(url_for('site.login'))
    return render_template('site/register/register.html', form=form)
开发者ID:mrhitman,项目名称:dgma,代码行数:30,代码来源:site.py

示例4: facebook_authorized

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import email [as 别名]
def facebook_authorized():
    resp = facebook.authorized_response()
    if resp is None:
        return 'Access denied: reason=%s error=%s' % (
            request.args['error_reason'],
            request.args['error_description']
        )
    if isinstance(resp, OAuthException):
        return 'Access denied: %s' % resp.message

    session['oauth_token'] = (resp['access_token'], '')
    me = facebook.get('/me')
    username = me.data['name']
    email= me.data['email']
    user = User.objects(email=email).first()
    if user:
        session['user_id'] = str(user.id)
    else:
        user = User()
        user.email = email
        user.username = username
        user.save()
        Inventory(owner=user.to_dbref(),
                      name='Basic',
                      is_basic=True).save()

    return redirect('/')
开发者ID:Rmanolis,项目名称:rpg-demo,代码行数:29,代码来源:app.py

示例5: post_app

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import email [as 别名]
def post_app():
    #print('form')
    signed_request = request.form.get('signed_request')
    data = facebook_tools.parse_signed_request(signed_request,
                                              FACEBOOK_APP_SECRET)
    print(signed_request)
    print(data)
    session['oauth_token'] = (data['oauth_token'],'')
    me = facebook.get('/me')
    username = me.data['name']
    email= me.data['email']
    user = User.objects(email=email).first()
    if user:
        session['user_id'] = str(user.id)
    else:
        user = User()
        user.email = email
        user.username = username
        user.save()
        Inventory(owner=user.to_dbref(),
                      name='Basic',
                      is_basic=True).save()


    return send_file('public/index.html')
开发者ID:Rmanolis,项目名称:rpg-demo,代码行数:27,代码来源:app.py

示例6: get

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import email [as 别名]
    def get(self):
        c = h.context()
        logging.info("***Auth2")
        cookies = h.get_default_cookies(self)
        c['cookies'] = cookies
        logging.info("***cookies: "+str(cookies))
        c['access_token'] = self.request.get("access_token")
        
        if self.request.get("access_token") == '':
            logging.error("No access token set, but we expected on %s" % str(self.request.url))
        else:
            logging.warning("Got access token %s" % self.request.get("access_token"))
        
        user = User.gql("WHERE fb_oauth_access_token = :1", self.request.get("access_token")).get()
        if user != None:
            # If the user currently exists in the DB
            logging.info("***SCU1")
            h.set_current_user(cookies, user)
            logging.info("***cookies: "+str(cookies))
            c['current_user'] = user
        else: 
            # Look user up in graph, and either find them in the DB or create them if they don't exist
            try:
                graph = facebook.GraphAPI(self.request.get("access_token"))
                me = graph.get_object('me')
            except Exception, e:
                logging.error(
                    "ERROR!  Failed to access Facebook Graph for access_token=" + 
                    self.request.get("access_token") +
                    "::" + str(e)) 
                me = None
                c['error'] = e

            if me != None:
                og_user = User.gql("WHERE fb_user_id = :1", str(me['id'])).get()
                
                if og_user == None:
                    new_user = User(
                        fb_user_id = str(me['id']),
                        fb_oauth_access_token = self.request.get("access_token"),
                        fb_oauth_access_token_stored_at = datetime.datetime.utcnow(),
                        first_name = me['first_name'], 
                        last_name = me['last_name'])
                    if 'email' in me:
                        new_user.email = me['email']
                    new_user.put()
                    logging.info("***SCU2")
                    h.set_current_user(cookies, new_user)
                    logging.info("***cookies: "+str(cookies))
                    c['current_user'] = new_user
                    
                else: # Update auth token for user because it's out of date
                    og_user.fb_oauth_access_token = self.request.get("access_token")
                    og_user.fb_oauth_access_token_stored_at = datetime.datetime.utcnow()
                    og_user.put()
                    logging.info("***SCU3")
                    h.set_current_user(cookies, og_user)
                    logging.info("***cookies: "+str(cookies))
                    c['current_user'] = og_user
开发者ID:codemuseum,项目名称:mykaribu2,代码行数:61,代码来源:main.py

示例7: create

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import email [as 别名]
def create(name, email, passwd):
    new = User()
    new.name = name
    new.email = email
    new.passwd = passwd
    db.session.add(new)
    db.session.commit()
    return login()
开发者ID:Sparklingj97,项目名称:Donquixote,代码行数:10,代码来源:app.py

示例8: create_user

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import email [as 别名]
 def create_user(self):
     user = User()
     user.username = 'test_username'
     user.password = 'test_password'
     user.name = 'test_name'
     user.email = '[email protected]'
     user.save()
     return user
开发者ID:aldarionsevero,项目名称:BusinemeWeb,代码行数:10,代码来源:test_post.py

示例9: convert_to_user

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import email [as 别名]
def convert_to_user(user_id, data_map):
    user = User(user_id)
    user.name = data_map['name']
    user.role = data_map['role']
    user.manager = data_map['manager']
    user.state = data_map['state']
    user.team = data_map['team']
    user.step = data_map['step']
    user.email = data_map['email']
    user.start_date = data_map['start_date']
    return user
开发者ID:LithiumH,项目名称:ChronoBot,代码行数:13,代码来源:chrono.py

示例10: set_user_details

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import email [as 别名]
 def set_user_details(fb_id,  name, last_name, email):
     user1 = User()
     qry = user1.check_fb_logged_in(fb_id)
     if not qry:
         user1.fb_id = fb_id
         user1.first_name = name
         user1.last_name = last_name
         user1.email = email
         id = user1.put()
         return id.id()
     else:
         return qry.key.id()
开发者ID:ItamarShDev,项目名称:attender-web,代码行数:14,代码来源:DAL.py

示例11: google_login

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import email [as 别名]
 def google_login(email, first, last):
     user1 = User()
     qry = User.query(User.email == email, User.first_name == first, User.last_name == last).get()
     logging.info(qry)
     if qry:
         return qry.key.id()
     else:
         user1.email = email
         user1.first_name = first
         user1.last_name = last
         token = user1.put()
         return token.id()
开发者ID:ItamarShDev,项目名称:attender-web,代码行数:14,代码来源:DAL.py

示例12: post

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import email [as 别名]
 def post(self):
     args = parser.parse_args()
     name = args['name']
     email = args['email']
     user = User(name)
     user.email = email
     db.session.add(user)
     setJSONFormat()
     try:
         db.session.commit()
         return jsonify(user)
     except Exception as e:
         return jsonify(message="Error : %s" % e)
开发者ID:tarigancana,项目名称:api_with_flask,代码行数:15,代码来源:user_api.py

示例13: create_test_user

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import email [as 别名]
def create_test_user():
    facebook_id = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(10))
    user = User()
    user.name = 'Rafael Goncalves'
    user.facebook_id = facebook_id
    user.birthday = date.today()
    user.friends = 299
    user.gender = 'male'
    user.platform = USER_PLATFORM_iOS
    user.email = '[email protected]'
    db.session.add(user)
    db.session.commit()
    token = Token(user.id)
    db.session.add(token)
    db.session.commit()
    return user
开发者ID:rafagonc,项目名称:share,代码行数:18,代码来源:helper.py

示例14: register

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import email [as 别名]
def register(email, username, password):
    user = User()
    user.email = email
    user.username = username
    user.password = password
    errors = user.validate_me()
    if errors:
        print(errors)
        return {'errors': errors}
    else:
        res = user.save_me()
        if 'id' in res.keys():
            user = User.objects(id=res['id']).first()
            Inventory(owner=user.to_dbref(),
                      name='Basic',
                      is_basic=True).save()
        return res
开发者ID:Rmanolis,项目名称:rpg-demo,代码行数:19,代码来源:authentication.py

示例15: register

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import email [as 别名]
 def register(email, hashed_password, first, last):
     user1 = User()
     qry = User.query(User.email==email, User.password==hashed_password, User.first_name==first, User.last_name==last).get()
     logging.info(qry)
     if qry:
         return 2
     qry = user1.check_user_exist_by_email(email)
     try:
         qry.password = hashed_password
         token = qry.put()
         return token.id()
     except:
         user1.email = email
         user1.password = hashed_password
         user1.first_name = first
         user1.last_name = last
         token = user1.put()
         return token.id()
开发者ID:ItamarShDev,项目名称:attender-web,代码行数:20,代码来源:DAL.py


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