def update_seller(store_id, seller_id): db = g._imdb form = request.form name = form.get('name', '') password = form.get('password', '') md5_password = form.get('md5_password', '') salt = form.get('salt', '') is_password_empty = not password and (not md5_password or not salt) if not name and is_password_empty: return INVALID_PARAM() if password: password = generate_password_hash(password) elif md5_password: password = "******"%(salt, md5_password) db.begin() if name: Seller.set_seller_name(db, store_id, seller_id, name) if password: Seller.set_seller_password(db, store_id, seller_id, password) db.commit() return ""
def reset_password(): if not request.data: raise MainException.ACCOUNT_PASSWORD_INVALID data = json.loads(request.data) code = data.get('code') password = data.get('password') password = generate_password_hash(password) if code: verify_email = Account.get_verify_email( g._db, code, EmailUsageType.SELLER_RESET_PWD) if verify_email: seller_id = verify_email['ro_id'] Seller.set_seller_password(g._db, 0, seller_id, password) return MainException.OK raise MainException.ACCOUNT_INVALID_EMAIL_CODE