mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-05 05:27:48 +00:00
# Pull Request Template ## Type of change ### Screenshots **Before** <img width="694" height="767" alt="image" src="https://github.com/user-attachments/assets/4a92816a-c13e-4750-88fc-b05fd6d05db6" /> <img width="395" height="690" alt="image" src="https://github.com/user-attachments/assets/eac0f15c-7c0f-4c20-942d-fbebdaec903e" /> <img width="506" height="753" alt="image" src="https://github.com/user-attachments/assets/b14bbf5a-5e0a-4ca5-91e2-dcc93b22ac26" /> **After** <img width="694" height="767" alt="image" src="https://github.com/user-attachments/assets/6984c8af-0e98-4688-bda4-fc5ceb3227ca" /> <img width="411" height="682" alt="image" src="https://github.com/user-attachments/assets/3b0f2c13-e4ea-4edc-9146-3c017d301a13" /> <img width="509" height="682" alt="image" src="https://github.com/user-attachments/assets/2090d3ed-36ef-4684-8185-3a0e6b1b0c15" /> ## Checklist: - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my code - [ ] I have commented on my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published in downstream modules
46 lines
1.6 KiB
Vue
46 lines
1.6 KiB
Vue
<script>
|
|
export default {
|
|
methods: {
|
|
getGoogleAuthUrl() {
|
|
// Ideally a request to /auth/google_oauth2 should be made
|
|
// Creating the URL manually because the devise-token-auth with
|
|
// omniauth has a standing issue on redirecting the post request
|
|
// https://github.com/lynndylanhurley/devise_token_auth/issues/1466
|
|
const baseUrl =
|
|
'https://accounts.google.com/o/oauth2/auth/oauthchooseaccount';
|
|
const clientId = window.chatwootConfig.googleOAuthClientId;
|
|
const redirectUri = window.chatwootConfig.googleOAuthCallbackUrl;
|
|
const responseType = 'code';
|
|
const scope = 'email profile';
|
|
|
|
// Build the query string
|
|
const queryString = new URLSearchParams({
|
|
client_id: clientId,
|
|
redirect_uri: redirectUri,
|
|
response_type: responseType,
|
|
scope: scope,
|
|
}).toString();
|
|
|
|
// Construct the full URL
|
|
return `${baseUrl}?${queryString}`;
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<!-- eslint-disable vue/no-unused-refs -->
|
|
<!-- Added ref for writing specs -->
|
|
<template>
|
|
<div class="flex flex-col">
|
|
<a
|
|
:href="getGoogleAuthUrl()"
|
|
class="inline-flex justify-center w-full px-4 py-3 bg-n-background dark:bg-n-solid-3 items-center rounded-md shadow-sm ring-1 ring-inset ring-n-container dark:ring-n-container focus:outline-offset-0 hover:bg-n-alpha-2 dark:hover:bg-n-alpha-2"
|
|
>
|
|
<span class="i-logos-google-icon h-6" />
|
|
<span class="ml-2 text-base font-medium text-n-slate-12">
|
|
{{ $t('LOGIN.OAUTH.GOOGLE_LOGIN') }}
|
|
</span>
|
|
</a>
|
|
</div>
|
|
</template>
|