display error & disable input based on user input

This commit is contained in:
Abdul Rifqi Al Abqary
2020-01-06 16:15:58 +09:00
parent b98d9074bb
commit 2e7e40c4cc

View File

@@ -469,6 +469,7 @@
<li> <li>
<label for="oidc-discovery-url">{{ $t("oidc_discovery_url") }}</label> <label for="oidc-discovery-url">{{ $t("oidc_discovery_url") }}</label>
<input <input
:disabled="this.authUrl !== '' || this.accessTokenUrl !== ''"
id="oidc-discovery-url" id="oidc-discovery-url"
name="oidc_discovery_url" name="oidc_discovery_url"
type="url" type="url"
@@ -481,6 +482,7 @@
<li> <li>
<label for="auth-url">{{ $t("auth_url") }}</label> <label for="auth-url">{{ $t("auth_url") }}</label>
<input <input
:disabled="this.oidcDiscoveryUrl !== ''"
id="auth-url" id="auth-url"
name="auth_url" name="auth_url"
type="url" type="url"
@@ -493,6 +495,7 @@
<li> <li>
<label for="access-token-url">{{ $t("access_token_url") }}</label> <label for="access-token-url">{{ $t("access_token_url") }}</label>
<input <input
:disabled="this.oidcDiscoveryUrl !== ''"
id="access-token-url" id="access-token-url"
name="access_token_url" name="access_token_url"
type="url" type="url"
@@ -2439,17 +2442,28 @@ export default {
} }
}, },
async handleAccessTokenRequest(){ async handleAccessTokenRequest(){
const tokenReqParams = { if (this.oidcDiscoveryUrl === "" && (this.authUrl === "" || this.accessTokenUrl === "")) {
grantType: "code", this.$toast.error("Please complete configuration urls.", {
oidcDiscoveryUrl: this.oidcDiscoveryUrl, icon: "error"
authUrl: this.authUrl, });
accessTokenUrl: this.accessTokenUrl, return;
clientId: this.clientId, }
clientSecret: this.clientSecret, try {
scope: this.scope, const tokenReqParams = {
clientAuth: this.clientAuth grantType: "code",
}; oidcDiscoveryUrl: this.oidcDiscoveryUrl,
await tokenRequest(tokenReqParams); authUrl: this.authUrl,
accessTokenUrl: this.accessTokenUrl,
clientId: this.clientId,
scope: this.scope,
clientAuth: this.clientAuth
};
await tokenRequest(tokenReqParams);
} catch (e) {
this.$toast.error(e, {
icon: "code"
});
}
}, },
async oauthRedirectReq() { async oauthRedirectReq() {
let tokenInfo = await oauthRedirect(); let tokenInfo = await oauthRedirect();