Ejemplo n.º 1
0
def login():

    data = request.get_json()
    if "loginid" not in data or "password" not in data:
        session["logged_in"] = False
        abort(401)
        return jsonify(dict(msg=u"정보가 일치하지 않습니다."))

    if "logged_in" in session and session["logged_in"]:
        session["logged_in"] = True
        return jsonify(dict(msg=u"이미 로그인 되어 있습니다."))

    user = User.login(data["loginid"], data["password"])

    if user:
        session["logged_in"] = True
        session["userid"] = user.id
        return jsonify(dict(name=user.name, loginid=user.loginid, msg=u"로그인 성공"))

    else:
        session["logged_in"] = False
        abort(401)
Ejemplo n.º 2
0
#-*- coding: utf-8 -*-

from DBP.models import Base,engine, session
from sqlalchemy import  MetaData
from datetime import datetime
from DBP.models.task import Task
from DBP.models.user import User, Enroll
import io


print User.login(u"admin", u"1234")