瀏覽代碼

Fixed Telegram & Twitter & Linkedin Login

BrettonYe 1 年之前
父節點
當前提交
7fe18cb025

+ 6 - 4
config/common.php

@@ -31,22 +31,24 @@ return [
     'oauth' => [
         'labels' => [
             'facebook' => 'Facebook',
-            'twitter' => 'Twitter',
-            'linkedin' => 'LinkedIn',
+            'twitter-oauth-2' => 'Twitter',
+            'linkedin-openid' => 'LinkedIn',
             'google' => 'Google',
             'github' => 'GitHub',
             'gitlab' => 'GitLab',
             'bitbucket' => 'Bitbucket',
+            'slack' => 'Slack',
             'telegram' => 'Telegram',
         ],
         'icon' => [
             'facebook' => 'fa-facebook',
-            'twitter' => 'fa-twitter',
-            'linkedin' => 'fa-linkedin',
+            'twitter-oauth-2' => 'fa-twitter',
+            'linkedin-openid' => 'fa-linkedin',
             'google' => 'fa-google',
             'github' => 'fa-github',
             'gitlab' => 'fa-gitlab',
             'bitbucket' => 'fa-bitbucket',
+            'slack' => 'fa-slack',
             'telegram' => 'fa-telegram',
         ],
     ],

+ 8 - 2
config/services.php

@@ -37,13 +37,13 @@ return [
         'redirect' => '',
     ],
 
-    'twitter' => [
+    'twitter-oauth-2' => [
         'client_id' => env('TWITTER_CLIENT_ID'),
         'client_secret' => env('TWITTER_CLIENT_SECRET'),
         'redirect' => '',
     ],
 
-    'linkedin' => [
+    'linkedin-openid' => [
         'client_id' => env('LINKEDIN_CLIENT_ID'),
         'client_secret' => env('LINKEDIN_CLIENT_SECRET'),
         'redirect' => '',
@@ -73,6 +73,12 @@ return [
         'redirect' => '',
     ],
 
+    'slack' => [
+        'client_id' => env('SLACK_CLIENT_ID'),
+        'client_secret' => env('SLACK_CLIENT_SECRET'),
+        'redirect' => '',
+    ],
+
     'telegram' => [
         'bot' => env('TELEGRAM_BOT_NAME'),  // The bot's username
         'client_id' => null,

+ 28 - 0
database/migrations/2024_04_24_215344_update_oauth_type.php

@@ -0,0 +1,28 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     */
+    public function up(): void
+    {
+        Schema::table('user_oauth', static function (Blueprint $table) {
+            $table->string('type', 20)->change();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     */
+    public function down(): void
+    {
+        Schema::table('user_oauth', static function (Blueprint $table) {
+            $table->string('type', 10)->change();
+        });
+    }
+};

File diff suppressed because it is too large
+ 0 - 0
public/assets/global/vendor/chart-js/chart.min.js


+ 1 - 1
resources/views/auth/login.blade.php

@@ -39,7 +39,7 @@
             @foreach (json_decode(sysConfig('oauth_path')) as $provider)
                 @if ($provider === 'telegram')
                     <div>
-                        {!! Socialite::driver('telegram')->getButton() !!}
+                        <script async src="https://telegram.org/js/telegram-widget.js?22" data-telegram-login="{{config('services.telegram.bot')}}" data-size="medium" data-auth-url="{{route('oauth.login', ['provider' => $provider])}}" data-request-access="write"></script>
                     </div>
                 @else
                     <a class="btn btn-icon btn-pure" href="{{route('oauth.route', ['provider' => $provider, 'operation' => 'login'])}}">

+ 16 - 13
resources/views/user/profile.blade.php

@@ -42,22 +42,25 @@
                             <span> {{trans('user.oauth.bind_title')}} </span>
                         </div>
                         <div class="user-socials list-group-gap list-group-full row m-0">
-                            @foreach (json_decode(sysConfig('oauth_path')) as $provider)
-                                <a class="list-group-item justify-content-center @if(in_array($provider, $auth, true)) col-10 @else col-12 @endif"
+                            @foreach (json_decode(sysConfig('oauth_path'), false) as $provider)
+                                <a class="list-group-item offset-lg-1 col-lg-8 col-10 d-flex justify-content-around align-items-center"
                                    @if($provider !== 'telegram') href="{{route('oauth.route', ['provider' => $provider, 'operation' => 'bind'])}}" @endif>
-                                    <i class="fa-brands {{ config('common.oauth.icon')[$provider] }} fa-lg mr-10" aria-hidden="true"></i> {{ ucfirst($provider) }}
-                                    :
-                                    @if(in_array($provider, $auth, true))
-                                        <span class="red-600">{{trans('user.oauth.rebind')}}</span>
-                                    @else
-                                        <span class="grey-500">{{trans('user.oauth.not_bind')}}</span>
-                                    @endif
-                                    @if($provider === 'telegram')
-                                        {!! Socialite::driver('telegram')->getButton() !!}
-                                    @endif
+                                    <span>
+                                        <i class="fa-brands {{ config('common.oauth.icon')[$provider] }} fa-lg mr-2" aria-hidden="true"></i> {{ config('common.oauth.labels')[$provider] }}:
+                                    </span>
+                                    <span>
+                                        @if(in_array($provider, $auth, true))
+                                            <span class="text-danger">{{trans('user.oauth.rebind')}}</span>
+                                        @else
+                                            <span class="text-muted">{{trans('user.oauth.not_bind')}}</span>
+                                        @endif
+                                        @if($provider === 'telegram')
+                                            <script async src="https://telegram.org/js/telegram-widget.js?22" data-telegram-login="{{config('services.telegram.bot')}}" data-size="medium" data-userpic="false" data-auth-url="{{route('oauth.bind', ['provider' => $provider])}}" data-request-access="write"></script>
+                                        @endif
+                                    </span>
                                 </a>
                                 @if(in_array($provider, $auth, true))
-                                    <a class="col-2 btn btn-block btn-danger my-auto" href="{{route('oauth.unbind', ['provider' => $provider])}}">{{trans('user.oauth.unbind')}}</a>
+                                    <a class="col-2 btn btn-danger btn-block my-auto" href="{{route('oauth.unbind', ['provider' => $provider])}}">{{trans('user.oauth.unbind')}}</a>
                                 @endif
                             @endforeach
                         </div>

Some files were not shown because too many files changed in this diff