def handle(self): userinfo_bytes = self.request.recv(1024) userinfo = json.loads(userinfo_bytes.decode("utf-8")) print(userinfo) if auth(**userinfo): self.request.send('连接成功'.encode("utf-8")) else: self.request.send('连接失败'.encode("utf-8"))
def post_login(): if 'login' in bottle.request.POST and 'password' in bottle.request.POST: login = bottle.request.POST['login'] password = bottle.request.POST['password'] if user.auth(login,password): save_session(login) bottle.redirect('/edit') return bottle.redirect('/')
def login(): if request.method == 'POST': username = request.form['username'].strip() password = request.form['password'].strip() if user.auth(username, password): session['username'] = request.form['username'] return redirect(url_for('index')) return render_template('login.html', page="login")