예제 #1
0
    def post(self):
        """  Return's the user's private client key. """
        if not authentication.supports_encrypted_credentials:
            raise NotFound()

        username = get_authenticated_user().username
        password = request.get_json()["password"]
        (result, error_message) = authentication.confirm_existing_user(username, password)
        if not result:
            raise request_error(message=error_message)

        return {"key": authentication.encrypt_user_password(password)}
예제 #2
0
    def post(self):
        """ Verifies the signed in the user with the specified credentials. """
        signin_data = request.get_json()
        password = signin_data["password"]

        username = get_authenticated_user().username
        (result, error_message) = authentication.confirm_existing_user(username, password)
        if not result:
            return {"message": error_message, "invalidCredentials": True,}, 403

        success, headers = common_login(result.uuid)
        if not success:
            return {"message": "Could not verify user.",}, 403

        return {"success": True}, 200, headers