class User(Base):
id = Column(Integer, primary_key=True)
email = Column(String(24), unique=True, nullable=False)
nickname = Column(String(24), unique=True)
auth = Column(SmallInteger, default=1)
_password = Column('password', String(100))
@property
def password(self):
return self._password
@password.setter
def set_password(self, raw):
self._password = generate_password_hash(raw)
@staticmethod
def register_by_email(nickname, account, secret):
with db.auto_commit():
user = User()
user.nickname = nickname
user.email = account
user.password = secret
db.session.add(user)
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
* Restarting with stat
* Debugger is active!
* Debugger PIN: 273-761-747
127.0.0.1 - - [19/Aug/2018 12:37:28] "POST /v1/client/register HTTP/1.1" 200 -
127.0.0.1 - - [19/Aug/2018 12:38:49] "POST /v1/client/register HTTP/1.1" 200
post:
{"account":"777@qq.com", "secret":"123456", "type":999, "nickname":"natume"}