def patch(self, user_id):
        """
        Update selected user profile

        Arguments
        ---------
        new_password: string
            New Password
        confirm_password: string
            New Password
        email: string
            Email address

        Returns
        -------
        result: JSON
            message, HTTP code
        """
        try:
            marsh_schema = parse_json_schema().load(request.json)
            args = marsh_schema
        except ValidationError as errors:
            logger.debug('Validation error: {}'.format(errors))
            return errors.messages, 500
        logger.debug('Updating user details')
        user = User.query.filter_by(id=user_id).first()
        if isinstance(user, User):
            ret = []
            if 'email' in args:
                if email_check(args['email']):
                    logger.debug('Adding email address: {}'.format(args['email']))
                    user.email = args['email']
                    ret.append({'msg': 'Email updated'})
            if 'new_password' in args and 'confirm_password' in args:
                if args['confirm_password'] and args['new_password']:
                    if args['new_password'] != args['confirm_password']:
                        return {'msg': 'Passwords do not match'}, 400
                    pass_hash = bcrypt.generate_password_hash(args['new_password']).decode('utf-8')
                    user.password = pass_hash
                    ret.append({'msg': 'Password updated'})
            if ret:
                db.session.commit()
                ###***logout any sessions belonging user here
                return jsonify(ret), 200
            return {'msg': 'Nothing to update'}, 200
        return {'msg': 'Error'}, 500

        Update selected user profile

        Arguments
        ---------
        new_password: string
            New Password
        confirm_password: string
            New Password
        email: string
            Email address

        Returns
        -------
        result: JSON
            message, HTTP code
        
crackq/cq_api.py