Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 10 additions & 15 deletions packages/frontend/src/components/Signin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<vscode-text-field
class="pt-8"
size="50"
type="url"
:value="this.target.defaultEndpoint"
@input="setEndpoint"
></vscode-text-field>
Expand Down Expand Up @@ -78,7 +79,6 @@
class="pt-8"
size="50"
placeholder="Enter your passcode"
v-on:keyup="btnStatus"
v-model="passcode"
ref="psc"
@input="(p) => (passcode = p.target.value)"
Expand All @@ -94,7 +94,6 @@
<br />
<vscode-text-field
class="pt-8"
v-on:keyup="btnStatus"
v-model="username"
:value="username"
@input="(u) => (username = u.target.value)"
Expand All @@ -107,7 +106,6 @@
<br />
<vscode-text-field
class="pt-8"
v-on:keyup="btnStatus"
v-model="password"
:value="password"
@input="(p) => (password = p.target.value)"
Expand All @@ -122,7 +120,7 @@
<br />
</span>
<br />
<vscode-button @click="SigninClicked" v-bind:disabled="disableButton">Sign in</vscode-button>
<vscode-button @click="SigninClicked" v-bind:disabled="isSignInEnable">Sign in</vscode-button>
</div>

<br /><br />
Expand All @@ -149,19 +147,17 @@ export default {
props: ["target", "rpc"],
data() {
return {
disableButton: true,
isLoggedIn: "",
authFailed: "",
ssoOrCredentials: "Credentials",
endpoint: "",
endpoint: this.target.defaultEndpoint,
passcode: "",
username: "",
password: "",
};
},
updated() {
this.isLoggedIn === "" ? (this.isLoggedIn = this.target.isLoggedIn) : "";
this.endpoint === "" ? (this.endpoint = this.target.defaultEndpoint) : "";
},
watch: {
isLoggedIn(newVal) {
Expand All @@ -184,27 +180,26 @@ export default {
credentialsVisibility() {
return this.ssoOrCredentials === "Credentials" ? "" : "none";
},
isSignInEnable() {
let isValue = !!this.endpoint;
if (isValue) {
isValue = this.ssoOrCredentials == "SSO" ? !!this.passcode : !!this.username && !!this.password;
}
return !isValue;
},
},
methods: {
btnStatus() {
if (this.ssoOrCredentials == "Credentials" && this.username != "" && this.password != "")
this.disableButton = false;
else if (this.ssoOrCredentials == "SSO" && this.passcode != "") this.disableButton = false;
else this.disableButton = true;
},
setEndpoint(val) {
this.endpoint = val.target.value;
},
paste() {
navigator.clipboard.readText().then((clipText) => {
this.passcode = clipText;
this.$refs.psc.value = this.passcode;
this.btnStatus();
});
},
setSSO(val) {
this.ssoOrCredentials = val.target.value;
this.disableButton = true;
},
SigninClicked() {
let payload = {};
Expand Down