Exemplo n.º 1
0
FederatedCredential* FederatedCredential::create(const String& id, const String& name, const String& avatar, const String& federation, ExceptionState& exceptionState)
{
    KURL avatarURL = parseStringAsURL(avatar, exceptionState);
    KURL federationURL = parseStringAsURL(federation, exceptionState);
    if (exceptionState.hadException())
        return nullptr;
    return new FederatedCredential(id, name, avatarURL, federationURL);
}
Exemplo n.º 2
0
Credential* Credential::create(const String& id, const String& name, const String& avatar, ExceptionState& exceptionState)
{
    KURL avatarURL = parseStringAsURL(avatar, exceptionState);
    if (exceptionState.hadException())
        return nullptr;
    return new Credential(id, name, avatarURL);
}
PasswordCredential* PasswordCredential::create(const PasswordCredentialData& data, ExceptionState& exceptionState)
{
    if (data.id().isEmpty()) {
        exceptionState.throwTypeError("'id' must not be empty.");
        return nullptr;
    }
    if (data.password().isEmpty()) {
        exceptionState.throwTypeError("'password' must not be empty.");
        return nullptr;
    }

    KURL iconURL = parseStringAsURL(data.iconURL(), exceptionState);
    if (exceptionState.hadException())
        return nullptr;

    return new PasswordCredential(data.id(), data.password(), data.name(), iconURL);
}