mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-27 18:40:39 +00:00
Merge remote-tracking branch 'origin/social_authentication' into subscription
# Conflicts: # .env.example # composer.lock # public/mix-manifest.json # resources/js/views/User/Password.vue # routes/api.php # src/App/Users/Actions/CreateNewUserAction.php # tests/App/Users/UserAccountTest.php
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
<template>
|
||||
<div class="wrapper flex flex-row w-1/2 ml-2">
|
||||
<div class="w-1/3 grid justify-items-center items-center cursor-pointer">
|
||||
<facebook-icon @click="socialiteRedirect('facebook')" />
|
||||
</div>
|
||||
|
||||
<div class="w-1/3 grid justify-items-center items-center cursor-pointer">
|
||||
<github-icon @click="socialiteRedirect('github')" />
|
||||
</div>
|
||||
|
||||
<div class="w-1/3 grid justify-items-center items-center cursor-pointer">
|
||||
<h1 @click="socialiteRedirect('google')">G</h1>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { FacebookIcon, GithubIcon } from 'vue-feather-icons'
|
||||
|
||||
export default {
|
||||
name:'SocialiteAuthenticationButtons',
|
||||
components: {
|
||||
FacebookIcon,
|
||||
GithubIcon,
|
||||
},
|
||||
methods: {
|
||||
socialiteRedirect(provider) {
|
||||
|
||||
this.isLoading = true
|
||||
|
||||
this.$store.dispatch('socialiteRedirect', provider)
|
||||
},
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
.wrapper {
|
||||
margin: 50px auto 0px auto;
|
||||
}
|
||||
|
||||
</style>
|
||||
Vendored
+9
@@ -1,4 +1,13 @@
|
||||
const routesAuth = [
|
||||
{
|
||||
name: 'SocialiteCallback',
|
||||
path: '/socialite/:provider/callback',
|
||||
component: () =>
|
||||
import(/* webpackChunkName: "chunks/email-verified" */ '../views/Auth/SocialiteCallback'),
|
||||
meta: {
|
||||
requiresAuth: false
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'SuccessfullyVerified',
|
||||
path: '/successfully-verified',
|
||||
|
||||
+11
@@ -48,6 +48,17 @@ const actions = {
|
||||
router.push({name: 'Homepage'})
|
||||
})
|
||||
},
|
||||
socialiteRedirect: ({commit}, provider) => {
|
||||
|
||||
axios
|
||||
.get(`/api/socialite/${provider}/redirect`)
|
||||
.then((response) => {
|
||||
if(response.data.url) {
|
||||
window.location.href = response.data.url
|
||||
}
|
||||
})
|
||||
.catch(() => this.$isSomethingWrong())
|
||||
},
|
||||
addToFavourites: (context, folder) => {
|
||||
let addFavourites = []
|
||||
let items = [folder]
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
:disabled="isLoading" />
|
||||
</ValidationObserver>
|
||||
|
||||
<SocialiteAuthenticationButtons/>
|
||||
|
||||
<span v-if="config.userRegistration" class="additional-link">
|
||||
{{ $t('page_login.registration_text') }}
|
||||
<router-link class="text-theme" :to="{name: 'SignUp'}">
|
||||
@@ -151,6 +153,7 @@
|
||||
<script>
|
||||
import AuthContentWrapper from '/resources/js/components/Auth/AuthContentWrapper'
|
||||
import {ValidationObserver, ValidationProvider} from 'vee-validate/dist/vee-validate.full'
|
||||
import SocialiteAuthenticationButtons from '/resources/js/components/Auth/SocialiteAuthenticationButtons'
|
||||
import AuthContent from '/resources/js/components/Auth/AuthContent'
|
||||
import AuthButton from '/resources/js/components/Auth/AuthButton'
|
||||
import Spinner from '/resources/js/components/FilesView/Spinner'
|
||||
@@ -162,10 +165,11 @@
|
||||
export default {
|
||||
name: 'SignIn',
|
||||
components: {
|
||||
Headline,
|
||||
Headline,
|
||||
AuthContentWrapper,
|
||||
ValidationProvider,
|
||||
ValidationObserver,
|
||||
SocialiteAuthenticationButtons,
|
||||
AuthContent,
|
||||
AuthButton,
|
||||
Spinner,
|
||||
@@ -233,8 +237,15 @@
|
||||
|
||||
this.checkedAccount = response.data
|
||||
|
||||
// Show sign in password page
|
||||
this.goToAuthPage('sign-in')
|
||||
if(response.data.oauth_provider) {
|
||||
// Redirect user to socialite login if he's accout is registered by socialite
|
||||
this.$store.dispatch('socialiteRedirect', response.data.oauth_provider)
|
||||
|
||||
} else {
|
||||
// Show sign in password page
|
||||
this.goToAuthPage('sign-in')
|
||||
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
|
||||
|
||||
@@ -62,6 +62,8 @@
|
||||
</div>
|
||||
</ValidationObserver>
|
||||
|
||||
<SocialiteAuthenticationButtons/>
|
||||
|
||||
<span class="additional-link">{{ $t('page_registration.have_an_account') }}
|
||||
<router-link :to="{name: 'SignIn'}" class="text-theme">
|
||||
{{ $t('page_forgotten_password.password_remember_button') }}
|
||||
@@ -78,6 +80,7 @@
|
||||
import {ValidationProvider, ValidationObserver} from 'vee-validate/dist/vee-validate.full'
|
||||
import AuthContent from '/resources/js/components/Auth/AuthContent'
|
||||
import AuthButton from '/resources/js/components/Auth/AuthButton'
|
||||
import SocialiteAuthenticationButtons from '/resources/js/components/Auth/SocialiteAuthenticationButtons'
|
||||
import {required} from 'vee-validate/dist/rules'
|
||||
import {mapGetters} from 'vuex'
|
||||
import {events} from '/resources/js/bus'
|
||||
@@ -86,6 +89,7 @@
|
||||
export default {
|
||||
name: 'SignUp',
|
||||
components: {
|
||||
SocialiteAuthenticationButtons,
|
||||
AuthContentWrapper,
|
||||
ValidationProvider,
|
||||
ValidationObserver,
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
<template>
|
||||
<div>
|
||||
<Spinner/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Spinner from '/resources/js/components/FilesView/Spinner'
|
||||
|
||||
export default {
|
||||
name: 'SocialiteCallback',
|
||||
components: {Spinner},
|
||||
created () {
|
||||
axios
|
||||
.get(`/api${this.$route.fullPath}`)
|
||||
.then(() => {
|
||||
|
||||
// Set login state
|
||||
this.$store.commit('SET_AUTHORIZED', true)
|
||||
|
||||
// Go to files page
|
||||
this.$router.push({name: 'Files'})
|
||||
})
|
||||
.catch((error) => {
|
||||
|
||||
this.$isSomethingWrong()
|
||||
|
||||
this.$router.push({name: 'Homepage'})
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user