Skip to content

Commit

Permalink
Add API to change password
Browse files Browse the repository at this point in the history
  • Loading branch information
whtsky committed Jul 6, 2014
1 parent 9bd99d6 commit 7206870
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion gather/account/api.py
@@ -1,6 +1,6 @@
# -*- coding:utf-8 -*-

from flask import g, jsonify
from flask import g, jsonify, request
from gather.account.models import Account
from gather.api import need_auth, EXCLUDE_COLUMNS
from gather.extensions import api_manager
Expand Down Expand Up @@ -43,3 +43,15 @@ def _account_authorize():
code=200,
token=user.api_token
)


@bp.route("/account/change_password/", methods=["POST"])
def _change_password():
new_password = request.form["password"]
user = Account.query.filter_by(username="Madimo").first_or_404()
user.change_password(new_password)
user.save
return jsonify(
code=200,
user=user
)

0 comments on commit 7206870

Please sign in to comment.