コード例 #1
0
ファイル: auth.py プロジェクト: qiuhaoling/my_flask
 def delete(self):
     parser = request.get_json()
     email = parser.get('email')
     password = parser.get('password')
     if email is None or password is None:
         abort(400)  # missing arguments
     if user_datastore.find_user(email=email) is None:
         abort(403)  # existing user
     user = user_datastore.find_user(email=email)
     user_datastore.delete_user(user)
     return 200
コード例 #2
0
ファイル: views.py プロジェクト: ioPush/ioPush-server
def deleteUser(nickname):
    """ Delete user account

        :return: Redirection to index page
    """
    # TODO - Delete associated posts
    if nickname != current_user.nickname:
        flash('Wrong user')
        return redirect(url_for('index'))
    user = User.query.filter_by(nickname=nickname).first()
    user_datastore.delete_user(user)
    user_datastore.commit()
    return redirect(url_for('index'))