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:
Čarodej
2022-01-10 07:38:56 +01:00
22 changed files with 481 additions and 32 deletions

View File

@@ -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 => {

View File

@@ -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,

View File

@@ -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>