This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
from concurrent import futures | |
import time | |
import logging | |
import grpc | |
import kv_pb2 | |
import kv_pb2_grpc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PasswordSchema(Schema): | |
password = fields.String(required=True) | |
repeat_password = fields.String(required=True) | |
@validates_schema | |
def validate(self, data): | |
""" check that passwords are equal | |
""" | |
password = data.get('password') | |
repeat_password = data.get('repeat_password') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ChangePasswordView(Resource): | |
schema_class = PasswordSchema | |
login_args = {'old_password': fields.Str(), | |
'password': fields.Str(lambda p: len(p) > 0), | |
'repeat_password': fields.Str(lambda p: len(p) > 0)} | |
@jwt_auth.login_required | |
def post(self, r_args, *args, **kwargs): | |
""" Change password | |
""" |