def approve(user):
"""Approve a registered user so that they can use API endpoints.
:param user: an instance of the `KlaxerUser` object to verify
:returns: an instance of the user that matched after updating it
:rtype: `klaxer.users.KlaxerUser`
"""
if user.approved:
logging.warn('noop - User %d already approved', user.id)
return user
user.approved = True
for message in user.messages:
if message.text == config.MSG_WELCOME:
session.delete(message)
session.add(user)
session.commit()
return user
评论列表
文章目录