Exemplo n.º 1
0
def login():
    username = request.args.get('username')
    if username:
        g.username = username
        login_signal.send()  # 这里用g对象传参
        return "登录成功"
    else:
        return "请输入用户名"
Exemplo n.º 2
0
def login():
    # 通过查询字符串的形式来传递username这个参数
    username = request.args.get('username')
    if username:
        g.username = username
        login_signal.send()
        return '登陆成功'
    else:
        return '请输入用户名'
Exemplo n.º 3
0
Arquivo: app.py Projeto: pipoted/web
	def post(self):
		username = request.args.get('username')
		# password = request.args.get('password')
		
		if username == 'xzx':
			login_signal.send()
			return 'success login'
		else:
			return 'error'
Exemplo n.º 4
0
def index():
    user = request.args.get("username")
    if user:
        g.username = user
        login_signal.send()
        if user == '123':
            abort(500)
        return "欢迎回来%s" % user
    else:
        return "请您登录"
Exemplo n.º 5
0
def login():
    #通过字符串查询的方式来传递字符串
    username = request.args.get('username')
    if username:
        g.username = username
        #发送信号
        login_signal.send()
        return '登陆成功'
    else:
        return '请输入用户名'
Exemplo n.º 6
0
def login():
    # http://127.0.0.1:5000/login/?username=chain
    username = request.args.get('username')
    g.username = username
    if username:
        # my_signal.send(username)
        # login_signal.send(username=username)
        login_signal.send()
        return "登录成功!"
    else:
        return "请输入用户名!"
Exemplo n.º 7
0
Arquivo: views.py Projeto: Joynice/eog
    def post(self):
        form = LoginForm(request.form)
        if form.validate():
            email = form.email.data
            password = form.password.data
            remember = form.remember.data
            user = User.objects(email=email).first()
            if user and password == user.password:
                session[config.DevelopmentConfig.
                        CMS_USER_ID] = user._id  # 保存用户登录信息
                ip = request.remote_addr
                NowTime = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
                login_signal.send(ip=ip, handler=email, login_time=NowTime)
                if remember:
                    # 如果设置session.permanent = True,那么过期时间为31天
                    session.permanent = True
                return redirect(url_for('eog.index'))
            else:
                return self.get(message='邮箱或者密码错误')

        else:
            # print(form.errors)
            message = form.get_error()
            return self.get(message=message)