def login(): if request.method == 'POST': id = request.form['id'] password = request.form['password'] mydb = DB() user_buffer = mydb.login(id, password) del mydb session.clear() if user_buffer: if user_buffer.m_delete: return render_template('alert_msg.html', msg="탈퇴한 회원입니다.") else: session['id'] = user_buffer.id session['permission'] = user_buffer.permission session['cell_phone'] = user_buffer.cell_phone session['email'] = user_buffer.email session['name'] = user_buffer.name session['sponsor_status'] = user_buffer.sponsor_status session['m_delete'] = user_buffer.m_delete return redirect(url_for('app.index')) else: return render_template('alert_msg.html', msg="Login Fail! 등록되지 않은 아이디거나 비밀번호가 다릅니다!") else: return render_template('alert_msg.html', msg="POST Error!")
def withdrawal(): data = OrderedDict() data['status'] = 'error' if request.method == 'POST': if session: password = request.form['PASSWORD'] db = DB() user_buf = db.login(session['id'], password) if user_buf == None: data['status'] = 'password_discordance' return jsonify(data) buf = user(\ id=user_buf.id, \ permission= session['permission'],\ password='',\ email='',\ name='',\ cell_phone='',\ m_delete=1) if db.modify(buf): if db.user_delete_update_board(buf.id): del db session.clear() data['status'] = 'ok' return jsonify(data) del db return jsonify(data)
def api_login(): id = request.json['id'] password = request.json['password'] data = OrderedDict() db = DB() flag = db.id_check(id) if flag == 0: data['status'] = 'id not found' return jsonify(data) user_buf = db.login(id, password) del db if user_buf: data['status'] = 'ok' data['id'] = user_buf.id data['permission'] = user_buf.permission return jsonify(data) else: data['status'] = 'password wrong' return jsonify(data)
def modify_password_check(): if request.method == 'POST': id = session['id'] password = request.form['password'] #보낼 json데이터 data = OrderedDict() db = DB() user_buf = db.login(id, password) del db if user_buf != None: data['status'] = 'ok' return jsonify(data) else: data['status'] = 'fail' return jsonify(data) data['status'] = 'error' return jsonify(data)