Skip to content

Commit

Permalink
hide oidc login for super-admin
Browse files Browse the repository at this point in the history
  • Loading branch information
f-w committed Feb 16, 2021
1 parent b1aa9ab commit c3dcf5d
Showing 1 changed file with 74 additions and 75 deletions.
149 changes: 74 additions & 75 deletions client/src/components/login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,77 +23,81 @@
<span>You are super-admin</span>
</v-tooltip>
</div>
<template v-if="!oidcUserManager">
<template v-if="$store.state.authnStrategy === 'accessToken'">
<div class="mr-1">Access Token</div>
<v-text-field
dark
single-line
hide-details
:value="accessToken"
@change="v => (accessToken = v)"
></v-text-field>
</template>
<v-dialog
v-model="dialog"
max-width="500px"
v-if="$store.state.authnStrategy === 'anonymous'"
>
<template v-slot:activator="{on}">
<v-btn plain v-on="on"> Login<v-icon>login</v-icon> </v-btn>
</template>
<v-card>
<v-card-title>
<span class="headline">Login</span>
</v-card-title>
<v-card-text>
<v-container>
<v-row>
<v-col cols="12">
<v-text-field
v-model="email"
label="email"
required
></v-text-field>
</v-col>
<v-col cols="12">
<v-text-field
v-model="password"
:append-icon="showPassword ? 'mdi-eye' : 'mdi-eye-off'"
@click:append="showPassword = !showPassword"
:type="showPassword ? 'text' : 'password'"
label="password"
counter
required
></v-text-field>
</v-col>
<v-col cols="12" v-if="loginError">
<v-alert color="red" dense type="error">
{{ loginError }}
</v-alert>
</v-col>
</v-row>
</v-container>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="primary" text @click="login">
Submit
</v-btn>
<v-btn color="error" text @click="dialog = false">
Cancel
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<template v-else>
<v-btn plain @click="oidclogin" v-if="showOidcLogin">
Login<v-icon>login</v-icon>
</v-btn>
<template v-if="!oidcUserManager">
<template v-if="$store.state.authnStrategy === 'accessToken'">
<div class="mr-1">Access Token</div>
<v-text-field
dark
single-line
hide-details
:value="accessToken"
@change="v => (accessToken = v)"
></v-text-field>
</template>
<v-dialog
v-model="dialog"
max-width="500px"
v-if="$store.state.authnStrategy === 'anonymous'"
>
<template v-slot:activator="{on}">
<v-btn plain v-on="on"> Login<v-icon>login</v-icon> </v-btn>
</template>
<v-card>
<v-card-title>
<span class="headline">Login</span>
</v-card-title>
<v-card-text>
<v-container>
<v-row>
<v-col cols="12">
<v-text-field
v-model="email"
label="email"
required
></v-text-field>
</v-col>
<v-col cols="12">
<v-text-field
v-model="password"
:append-icon="showPassword ? 'mdi-eye' : 'mdi-eye-off'"
@click:append="showPassword = !showPassword"
:type="showPassword ? 'text' : 'password'"
label="password"
counter
required
></v-text-field>
</v-col>
<v-col cols="12" v-if="loginError">
<v-alert color="red" dense type="error">
{{ loginError }}
</v-alert>
</v-col>
</v-row>
</v-container>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="primary" text @click="login">
Submit
</v-btn>
<v-btn color="error" text @click="dialog = false">
Cancel
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<template v-else>
<div>{{ oidcUser.profile.name }}</div>
<v-btn plain @click="oidcLogout"> Logout<v-icon>logout</v-icon> </v-btn>
<v-btn plain @click="oidclogin" v-if="!oidcUser">
Login<v-icon>login</v-icon>
</v-btn>
<template v-else>
<div>{{ oidcUser.profile.name }}</div>
<v-btn plain @click="oidcLogout">
Logout<v-icon>logout</v-icon>
</v-btn>
</template>
</template>
</template>
</v-toolbar-items>
Expand All @@ -116,11 +120,6 @@ export default {
};
},
computed: {
showOidcLogin: {
get() {
return window.oidcAuthority && !this.oidcUser ? true : false;
},
},
accessToken: {
get() {
return this.$store.state.accessToken;
Expand Down Expand Up @@ -154,7 +153,7 @@ export default {
this.$router.push(this.$router.currentRoute.path);
this.$router.go(this.$router.currentRoute);
} catch (ex) {
console.log(ex);
true;
}
}
},
Expand Down

0 comments on commit c3dcf5d

Please sign in to comment.