Skip to content

Commit b748e33

Browse files
committed
Merge branch 'develop'
2 parents 31006e1 + fb37899 commit b748e33

File tree

9 files changed

+3454
-2840
lines changed

9 files changed

+3454
-2840
lines changed

package-lock.json

Lines changed: 3391 additions & 2816 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"build:script": "vue-cli-service build --mode production --dest dist --inline-vue --name insights"
2525
},
2626
"dependencies": {
27-
"@mdi/font": "^6.7.96",
27+
"@mdi/font": "^7.1.96",
2828
"firebase": "^9.8.4",
2929
"v-mask": "^2.3.0",
3030
"vue": "^2.6.14",

src/components/Branding.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
{{ config.title }}
99
</v-list-item-title>
10+
1011
<v-list-item-subtitle>
1112
<div class="ml-1">
1213
{{ config.subtitle }}

src/components/Guard.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
</v-tab>
2929
<v-tab v-if="isLoginWithPhoneShown"> Sign In </v-tab>
3030
<v-tab v-if="!isResetPasswordScreenShown && isUserRegistrationAllowed"> Register </v-tab>
31-
<v-tab v-if="isResetPasswordScreenShown || !isUserRegistrationAllowed"> Reset Password </v-tab>
31+
<v-tab v-if="(isResetPasswordScreenShown || !isUserRegistrationAllowed) && config.email"> Reset Password </v-tab>
3232
</v-tabs>
3333

3434
<v-tabs-items :value="tab" @change="SET_TAB($event)">
@@ -44,7 +44,7 @@
4444
<Register />
4545
</v-tab-item>
4646

47-
<v-tab-item v-if="isResetPasswordScreenShown || !isUserRegistrationAllowed" class="pt-5">
47+
<v-tab-item v-if="(isResetPasswordScreenShown || !isUserRegistrationAllowed) && !config.email" class="pt-5">
4848
<PasswordReset />
4949
</v-tab-item>
5050
</v-tabs-items>

src/components/Login.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88

99
<!-- application branding -->
1010
<branding v-else class="text-center" />
11+
</v-card>
1112

13+
<v-card v-if="config.email" flat>
1214
<!-- login form -->
1315
<v-card-text class="mb-0 pb-0">
1416
<v-text-field v-model="email" required class="mr-2" label="Email" prepend-icon="mdi-account" />
@@ -56,7 +58,7 @@
5658

5759
<script>
5860
import Branding from "./Branding.vue"
59-
import { mapGetters, mapMutations, mapActions } from "vuex"
61+
import { mapState, mapGetters, mapMutations, mapActions } from "vuex"
6062
6163
export default {
6264
components: { Branding },
@@ -68,6 +70,7 @@ export default {
6870
}),
6971
7072
computed: {
73+
...mapState("auth", ["config"]),
7174
...mapGetters("auth", ["getSessionPersistence", "isLoading", "getError"]),
7275
},
7376

src/components/LoginWithProvider.vue

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<template>
2-
<v-container v-if="config.google || config.facebook || config.phone" class="text-center ma-0 pa-0">
3-
<div class="caption">or login with</div>
2+
<v-container v-if="isLoginWithProvidersActive" class="text-center ma-0 pa-0">
3+
<div class="caption"><span v-if="config.email">or </span>login with</div>
44

55
<v-container>
66
<v-tooltip v-if="config.google" top>
77
<template #activator="{ on, attrs }">
8-
<v-btn color="#db3236" class="mr-2" v-bind="attrs" fab dark small v-on="on" @click="loginWithGoogle()">
8+
<v-btn color="#db3236" class="mr-2" v-bind="attrs" :fab="!isOnlySingleProvider" dark small v-on="on" @click="loginWithGoogle()">
99
<v-icon>mdi-google</v-icon>
1010
</v-btn>
1111
</template>
@@ -15,7 +15,7 @@
1515

1616
<v-tooltip v-if="config.facebook" top>
1717
<template #activator="{ on, attrs }">
18-
<v-btn color="#3b5998" class="mr-2" v-bind="attrs" fab dark small v-on="on" @click="loginWithFacebook()">
18+
<v-btn color="#3b5998" class="mr-2" v-bind="attrs" :fab="!isOnlySingleProvider" dark small v-on="on" @click="loginWithFacebook()">
1919
<v-icon>mdi-facebook</v-icon>
2020
</v-btn>
2121
</template>
@@ -25,13 +25,24 @@
2525

2626
<v-tooltip v-if="config.phone" top>
2727
<template #activator="{ on, attrs }">
28-
<v-btn color="primary" v-bind="attrs" fab dark small v-on="on" @click="SET_SHOW_LOGIN_WITH_PHONE(true)">
28+
<v-btn color="primary" class="mr-2" v-bind="attrs" :fab="!isOnlySingleProvider" dark small v-on="on" @click="SET_SHOW_LOGIN_WITH_PHONE(true)">
2929
<v-icon>mdi-cellphone</v-icon>
3030
</v-btn>
3131
</template>
3232

3333
<span>Authenticate with Text Message To Your Phone</span>
3434
</v-tooltip>
35+
36+
<v-tooltip v-if="config.saml" top>
37+
<template #activator="{ on, attrs }">
38+
<v-btn color="secondary" v-bind="attrs" :fab="!isOnlySingleProvider" dark :small="!isOnlySingleProvider" v-on="on" @click="loginWithSaml()">
39+
<v-icon>mdi-onepassword</v-icon>
40+
<span v-if="isOnlySingleProvider" class="ml-2">{{ config.saml_text }}</span>
41+
</v-btn>
42+
</template>
43+
44+
<span>Authenticate with SAML provider</span>
45+
</v-tooltip>
3546
</v-container>
3647
</v-container>
3748
</template>
@@ -42,11 +53,11 @@ import { mapState, mapGetters, mapMutations, mapActions } from "vuex"
4253
export default {
4354
computed: {
4455
...mapState("auth", ["config"]),
45-
...mapGetters("auth", ["isLoading"]),
56+
...mapGetters("auth", ["isLoading", "isLoginWithProvidersActive", "isOnlySingleProvider"]),
4657
},
4758
4859
methods: {
49-
...mapActions("auth", ["loginWithGoogle", "loginWithFacebook", "loginWithPhone"]),
60+
...mapActions("auth", ["loginWithGoogle", "loginWithFacebook", "loginWithPhone", "loginWithSaml"]),
5061
...mapMutations("auth", ["SET_SHOW_LOGIN_WITH_PHONE"]),
5162
},
5263
}

src/plugins/auth.js

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,26 @@ import router from "@/router"
44
import firebase from "@/middleware/firebase"
55
import AuthGuard from "../wrapper"
66

7-
const debug = true
8-
const session = "local" // or "browser" see: https://firebase.google.com/docs/auth/web/auth-state-persistence
9-
const phone = true
10-
const google = true
11-
const facebook = true
12-
const verification = true
13-
147
const authGuardSettings = {
15-
debug,
8+
debug: true,
9+
session: "local", // or "browser" see: https://firebase.google.com/docs/auth/web/auth-state-persistence
1610
store,
1711
router,
18-
session,
1912
firebase,
20-
phone,
21-
google,
22-
facebook,
23-
verification,
13+
saml: true,
14+
saml_text: "Login with OKTA",
15+
saml_provider_id: "saml.okta",
16+
email: false,
17+
phone: false,
18+
google: false,
19+
facebook: false,
20+
registration: false,
21+
verification: true,
22+
23+
title: "AUTH DEMO",
24+
subtitle: "Firebase Auth Demo for Veutify",
25+
icon: "mdi-test-tube",
26+
iconColor: "#FF6D00",
2427
}
2528

2629
Vue.use(AuthGuard, authGuardSettings)

src/store/auth/auth-actions.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,13 @@ export default {
127127
//
128128
loginWithPhone({ state }) {},
129129

130+
loginWithSaml({ state }) {
131+
const provider = new SAMLAuthProvider(state.config.saml_provider_id)
132+
const auth = getAuth(Vue.prototype.$authGuardFirebaseApp)
133+
134+
signInWithRedirect(auth, provider)
135+
},
136+
130137
//
131138
async textPhoneVerificationCode({ state, commit }, { phoneNumber, recaptchaVerifier }) {
132139
try {

src/store/auth/auth-getters.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,18 @@ export default {
8383
isLoginWithPhoneShown(state) {
8484
return state.is_login_with_phone_shown
8585
},
86+
isLoginWithProvidersActive(state) {
87+
return state.config.google || state.config.facebook || state.config.phone || state.config.saml
88+
},
89+
isOnlySingleProvider(state) {
90+
let cc = 0
91+
const check = ["google", "facebook", "phone", "saml"]
92+
93+
check.forEach((c) => {
94+
if (state.config[c] === true) cc++
95+
})
96+
97+
// to render large button instead icon
98+
return cc === 1
99+
},
86100
}

0 commit comments

Comments
 (0)