add auth by apple

parent 191f1ef3
...@@ -16,6 +16,7 @@ class UserController extends Controller ...@@ -16,6 +16,7 @@ class UserController extends Controller
} }
public function store(Request $request) { public function store(Request $request) {
//dd($request->all());
$request->validate([ $request->validate([
'name' => 'required', 'name' => 'required',
...@@ -23,13 +24,11 @@ class UserController extends Controller ...@@ -23,13 +24,11 @@ class UserController extends Controller
'password' => 'required|confirmed', 'password' => 'required|confirmed',
]); ]);
//dd($request->all());
session()->flash('success', 'Successful registration');
$user = User::create([ $user = User::create([
'name' => $request->name, // || 'name' => $request->input('name'), 'name' => $request->name, // || 'name' => $request->input('name'),
'email' => $request->email, 'email' => $request->email,
'password' => Hash::make($request->password), 'password' => Hash::make($request->password),
'email_verified_at' => NOW(),
]); ]);
session()->flash('success', 'Successful registration'); session()->flash('success', 'Successful registration');
...@@ -37,6 +36,31 @@ class UserController extends Controller ...@@ -37,6 +36,31 @@ class UserController extends Controller
return redirect()->route('home'); // || redirect()->home(); || redirect('/'); return redirect()->route('home'); // || redirect()->home(); || redirect('/');
} }
public function edit(Request $request) {
//dd($request->all());
$request->validate([
'name' => 'required',
'email' => 'required|email',
'password' => 'required|confirmed',
]);
$user = Auth()->user();
$user->name = $request->name;
$user->email = $request->email;
$user->password = Hash::make($request->password);
$user->email_verified_at = NOW();
if ($user->save()) {
session()->flash('success', 'Sittings saved successful');
return redirect()->back();
}
return redirect()->back()->with('error', 'Sittings saving error');
}
public function loginForm() { public function loginForm() {
return view('user.login'); return view('user.login');
} }
...@@ -82,6 +106,27 @@ class UserController extends Controller ...@@ -82,6 +106,27 @@ class UserController extends Controller
return redirect()->route('home'); return redirect()->route('home');
} }
public function loginFacebook() {
$facebookUser = Socialite::driver('facebook')->user();
dd($facebookUser);
/*
$user = User::where('email','=', $googleUser->email)->first();
if (!$user) {
$user = User::create([
'name' => $googleUser->name,
'email' => $googleUser->email,
'password' => Hash::make(config('project.empty_password')),
]);
}
Auth::login($user);
return redirect()->route('home');
*
*/
}
} }
...@@ -12,6 +12,6 @@ class VerifyCsrfToken extends Middleware ...@@ -12,6 +12,6 @@ class VerifyCsrfToken extends Middleware
* @var array<int, string> * @var array<int, string>
*/ */
protected $except = [ protected $except = [
// '/login/apple/callback',
]; ];
} }
...@@ -18,6 +18,11 @@ class EventServiceProvider extends ServiceProvider ...@@ -18,6 +18,11 @@ class EventServiceProvider extends ServiceProvider
Registered::class => [ Registered::class => [
SendEmailVerificationNotification::class, SendEmailVerificationNotification::class,
], ],
\SocialiteProviders\Manager\SocialiteWasCalled::class => [
//\SocialiteProviders\Apple\AppleExtendSocialite::class.'@handle',
[\SocialiteProviders\Apple\AppleExtendSocialite::class, 'handle']
],
]; ];
/** /**
......
...@@ -6,11 +6,14 @@ ...@@ -6,11 +6,14 @@
"license": "MIT", "license": "MIT",
"require": { "require": {
"php": "^8.1", "php": "^8.1",
"genealabs/laravel-sign-in-with-apple": "^0.7.0",
"genealabs/laravel-socialiter": "^10.0",
"guzzlehttp/guzzle": "^7.2", "guzzlehttp/guzzle": "^7.2",
"laravel/framework": "^10.10", "laravel/framework": "^10.10",
"laravel/sanctum": "^3.2", "laravel/sanctum": "^3.2",
"laravel/socialite": "^5.6", "laravel/socialite": "^5.6",
"laravel/tinker": "^2.8" "laravel/tinker": "^2.8",
"socialiteproviders/apple": "^5.5"
}, },
"require-dev": { "require-dev": {
"fakerphp/faker": "^1.9.1", "fakerphp/faker": "^1.9.1",
...@@ -59,7 +62,8 @@ ...@@ -59,7 +62,8 @@
"sort-packages": true, "sort-packages": true,
"allow-plugins": { "allow-plugins": {
"pestphp/pest-plugin": true, "pestphp/pest-plugin": true,
"php-http/discovery": true "php-http/discovery": true,
"symfony/thanks": true
} }
}, },
"minimum-stability": "stable", "minimum-stability": "stable",
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "a82cca88f00f5740ba7f164043bf06fc", "content-hash": "0287343da2ecbdb8d4c4d640fa53b6ac",
"packages": [ "packages": [
{ {
"name": "brick/math", "name": "brick/math",
...@@ -432,6 +432,69 @@ ...@@ -432,6 +432,69 @@
], ],
"time": "2023-01-14T14:17:03+00:00" "time": "2023-01-14T14:17:03+00:00"
}, },
{
"name": "firebase/php-jwt",
"version": "v6.7.0",
"source": {
"type": "git",
"url": "https://github.com/firebase/php-jwt.git",
"reference": "71278f20b0a623389beefe87a641d03948a38870"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/firebase/php-jwt/zipball/71278f20b0a623389beefe87a641d03948a38870",
"reference": "71278f20b0a623389beefe87a641d03948a38870",
"shasum": ""
},
"require": {
"php": "^7.4||^8.0"
},
"require-dev": {
"guzzlehttp/guzzle": "^6.5||^7.4",
"phpspec/prophecy-phpunit": "^2.0",
"phpunit/phpunit": "^9.5",
"psr/cache": "^1.0||^2.0",
"psr/http-client": "^1.0",
"psr/http-factory": "^1.0"
},
"suggest": {
"ext-sodium": "Support EdDSA (Ed25519) signatures",
"paragonie/sodium_compat": "Support EdDSA (Ed25519) signatures when libsodium is not present"
},
"type": "library",
"autoload": {
"psr-4": {
"Firebase\\JWT\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Neuman Vong",
"email": "neuman+pear@twilio.com",
"role": "Developer"
},
{
"name": "Anant Narayanan",
"email": "anant@php.net",
"role": "Developer"
}
],
"description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.",
"homepage": "https://github.com/firebase/php-jwt",
"keywords": [
"jwt",
"php"
],
"support": {
"issues": "https://github.com/firebase/php-jwt/issues",
"source": "https://github.com/firebase/php-jwt/tree/v6.7.0"
},
"time": "2023-06-14T15:29:26+00:00"
},
{ {
"name": "fruitcake/php-cors", "name": "fruitcake/php-cors",
"version": "v1.2.0", "version": "v1.2.0",
...@@ -503,6 +566,172 @@ ...@@ -503,6 +566,172 @@
], ],
"time": "2022-02-20T15:07:15+00:00" "time": "2022-02-20T15:07:15+00:00"
}, },
{
"name": "genealabs/laravel-overridable-model",
"version": "10.0.0",
"source": {
"type": "git",
"url": "https://github.com/GeneaLabs/laravel-overridable-model.git",
"reference": "3a320e9ccbee1effa62f24970f7a144b98ebec1f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/GeneaLabs/laravel-overridable-model/zipball/3a320e9ccbee1effa62f24970f7a144b98ebec1f",
"reference": "3a320e9ccbee1effa62f24970f7a144b98ebec1f",
"shasum": ""
},
"require": {
"illuminate/support": "^10.0",
"symfony/thanks": "^1.2"
},
"type": "library",
"autoload": {
"psr-4": {
"GeneaLabs\\LaravelOverridableModel\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Provide a uniform method of allowing models to be overridden in Laravel.",
"keywords": [
"laravel",
"nova"
],
"support": {
"issues": "https://github.com/GeneaLabs/laravel-overridable-model/issues",
"source": "https://github.com/GeneaLabs/laravel-overridable-model/tree/10.0.0"
},
"time": "2023-05-20T20:12:51+00:00"
},
{
"name": "genealabs/laravel-sign-in-with-apple",
"version": "0.7.0",
"source": {
"type": "git",
"url": "https://github.com/GeneaLabs/laravel-sign-in-with-apple.git",
"reference": "a27c5cb85eb689b417f356d772c773c9a5282a5d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/GeneaLabs/laravel-sign-in-with-apple/zipball/a27c5cb85eb689b417f356d772c773c9a5282a5d",
"reference": "a27c5cb85eb689b417f356d772c773c9a5282a5d",
"shasum": ""
},
"require": {
"illuminate/support": "^10.0",
"laravel/socialite": "^5.6",
"php": "^8.1"
},
"require-dev": {
"orchestra/testbench": "^8.0",
"orchestra/testbench-browser-kit": "^7.12",
"orchestra/testbench-dusk": "^7.20",
"phpunit/phpunit": "^9.5.10",
"predis/predis": "^2.1"
},
"suggest": {
"genealabs/laravel-socialiter": "Automatic user resolution and persistence for any Laravel Socialite driver."
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"\\GeneaLabs\\LaravelSignInWithApple\\Providers\\ServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"GeneaLabs\\LaravelSignInWithApple\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mike Bronner",
"email": "hello@genealabs.com",
"homepage": "https://genealabs.com",
"role": "Developer"
}
],
"description": "Add Apple's new single-signon feature to your site with ease.",
"support": {
"issues": "https://github.com/GeneaLabs/laravel-sign-in-with-apple/issues",
"source": "https://github.com/GeneaLabs/laravel-sign-in-with-apple/tree/0.7.0"
},
"funding": [
{
"url": "https://github.com/mikebronner",
"type": "github"
}
],
"time": "2023-02-26T15:15:40+00:00"
},
{
"name": "genealabs/laravel-socialiter",
"version": "10.0.0",
"source": {
"type": "git",
"url": "https://github.com/GeneaLabs/laravel-socialiter.git",
"reference": "12cea6a215cd2ff4a613ac1275ac197b20090828"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/GeneaLabs/laravel-socialiter/zipball/12cea6a215cd2ff4a613ac1275ac197b20090828",
"reference": "12cea6a215cd2ff4a613ac1275ac197b20090828",
"shasum": ""
},
"require": {
"genealabs/laravel-overridable-model": "^10.0",
"illuminate/auth": "^10.0",
"illuminate/database": "^10.0",
"illuminate/support": "^10.0",
"laravel/socialite": "^5.3"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"\\GeneaLabs\\LaravelSocialiter\\Providers\\ServiceProvider"
],
"aliases": {
"Socialiter": "\\GeneaLabs\\LaravelSocialiter\\Facades\\Socialiter"
}
}
},
"autoload": {
"psr-4": {
"GeneaLabs\\LaravelSocialiter\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mike Bronner",
"email": "hello@genealabs.com"
}
],
"description": "Automatically manager user persistence and resolution for any Laravel Socialite provider.",
"support": {
"issues": "https://github.com/GeneaLabs/laravel-socialiter/issues",
"source": "https://github.com/GeneaLabs/laravel-socialiter/tree/10.0.0"
},
"funding": [
{
"url": "https://github.com/mikebronner",
"type": "github"
}
],
"time": "2023-05-20T21:00:34+00:00"
},
{ {
"name": "graham-campbell/result-type", "name": "graham-campbell/result-type",
"version": "v1.1.1", "version": "v1.1.1",
...@@ -1438,6 +1667,144 @@ ...@@ -1438,6 +1667,144 @@
}, },
"time": "2023-02-15T16:40:09+00:00" "time": "2023-02-15T16:40:09+00:00"
}, },
{
"name": "lcobucci/clock",
"version": "3.1.0",
"source": {
"type": "git",
"url": "https://github.com/lcobucci/clock.git",
"reference": "30a854ceb22bd87d83a7a4563b3f6312453945fc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/lcobucci/clock/zipball/30a854ceb22bd87d83a7a4563b3f6312453945fc",
"reference": "30a854ceb22bd87d83a7a4563b3f6312453945fc",
"shasum": ""
},
"require": {
"php": "~8.2.0",
"psr/clock": "^1.0"
},
"provide": {
"psr/clock-implementation": "1.0"
},
"require-dev": {
"infection/infection": "^0.26",
"lcobucci/coding-standard": "^10.0.0",
"phpstan/extension-installer": "^1.2",
"phpstan/phpstan": "^1.10.7",
"phpstan/phpstan-deprecation-rules": "^1.1.3",
"phpstan/phpstan-phpunit": "^1.3.10",
"phpstan/phpstan-strict-rules": "^1.5.0",
"phpunit/phpunit": "^10.0.17"
},
"type": "library",
"autoload": {
"psr-4": {
"Lcobucci\\Clock\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Luís Cobucci",
"email": "lcobucci@gmail.com"
}
],
"description": "Yet another clock abstraction",
"support": {
"issues": "https://github.com/lcobucci/clock/issues",
"source": "https://github.com/lcobucci/clock/tree/3.1.0"
},
"funding": [
{
"url": "https://github.com/lcobucci",
"type": "github"
},
{
"url": "https://www.patreon.com/lcobucci",
"type": "patreon"
}
],
"time": "2023-03-20T19:12:25+00:00"
},
{
"name": "lcobucci/jwt",
"version": "4.3.0",
"source": {
"type": "git",
"url": "https://github.com/lcobucci/jwt.git",
"reference": "4d7de2fe0d51a96418c0d04004986e410e87f6b4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/lcobucci/jwt/zipball/4d7de2fe0d51a96418c0d04004986e410e87f6b4",
"reference": "4d7de2fe0d51a96418c0d04004986e410e87f6b4",
"shasum": ""
},
"require": {
"ext-hash": "*",
"ext-json": "*",
"ext-mbstring": "*",
"ext-openssl": "*",
"ext-sodium": "*",
"lcobucci/clock": "^2.0 || ^3.0",
"php": "^7.4 || ^8.0"
},
"require-dev": {
"infection/infection": "^0.21",
"lcobucci/coding-standard": "^6.0",
"mikey179/vfsstream": "^1.6.7",
"phpbench/phpbench": "^1.2",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "^1.4",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpstan/phpstan-phpunit": "^1.0",
"phpstan/phpstan-strict-rules": "^1.0",
"phpunit/php-invoker": "^3.1",
"phpunit/phpunit": "^9.5"
},
"type": "library",
"autoload": {
"psr-4": {
"Lcobucci\\JWT\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Luís Cobucci",
"email": "lcobucci@gmail.com",
"role": "Developer"
}
],
"description": "A simple library to work with JSON Web Token and JSON Web Signature",
"keywords": [
"JWS",
"jwt"
],
"support": {
"issues": "https://github.com/lcobucci/jwt/issues",
"source": "https://github.com/lcobucci/jwt/tree/4.3.0"
},
"funding": [
{
"url": "https://github.com/lcobucci",
"type": "github"
},
{
"url": "https://www.patreon.com/lcobucci",
"type": "patreon"
}
],
"time": "2023-01-02T13:28:00+00:00"
},
{ {
"name": "league/commonmark", "name": "league/commonmark",
"version": "2.4.0", "version": "2.4.0",
...@@ -2475,6 +2842,54 @@ ...@@ -2475,6 +2842,54 @@
], ],
"time": "2023-02-25T19:38:58+00:00" "time": "2023-02-25T19:38:58+00:00"
}, },
{
"name": "psr/clock",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/clock.git",
"reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/clock/zipball/e41a24703d4560fd0acb709162f73b8adfc3aa0d",
"reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d",
"shasum": ""
},
"require": {
"php": "^7.0 || ^8.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Psr\\Clock\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common interface for reading the clock.",
"homepage": "https://github.com/php-fig/clock",
"keywords": [
"clock",
"now",
"psr",
"psr-20",
"time"
],
"support": {
"issues": "https://github.com/php-fig/clock/issues",
"source": "https://github.com/php-fig/clock/tree/1.0.0"
},
"time": "2022-11-25T14:36:26+00:00"
},
{ {
"name": "psr/container", "name": "psr/container",
"version": "2.0.2", "version": "2.0.2",
...@@ -3140,6 +3555,151 @@ ...@@ -3140,6 +3555,151 @@
], ],
"time": "2023-04-15T23:01:58+00:00" "time": "2023-04-15T23:01:58+00:00"
}, },
{
"name": "socialiteproviders/apple",
"version": "5.5.1",
"source": {
"type": "git",
"url": "https://github.com/SocialiteProviders/Apple.git",
"reference": "be7240d6cacb04adfbeb357409c115feb79dcc6c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/SocialiteProviders/Apple/zipball/be7240d6cacb04adfbeb357409c115feb79dcc6c",
"reference": "be7240d6cacb04adfbeb357409c115feb79dcc6c",
"shasum": ""
},
"require": {
"ext-json": "*",
"ext-openssl": "*",
"firebase/php-jwt": "^6.2",
"lcobucci/jwt": "^4.1.5",
"php": "^7.4 || ^8.0",
"socialiteproviders/manager": "~4.0"
},
"suggest": {
"ahilmurugesan/socialite-apple-helper": "Automatic Apple client key generation and management."
},
"type": "library",
"autoload": {
"psr-4": {
"SocialiteProviders\\Apple\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Ahilan",
"email": "ahilmurugesan@gmail.com",
"role": "Developer"
},
{
"name": "Vamsi Krishna V",
"email": "vamsi@vonectech.com",
"homepage": "https://vonectech.com/",
"role": "Farmer"
}
],
"description": "Apple OAuth2 Provider for Laravel Socialite",
"keywords": [
"apple",
"apple client key",
"apple sign in",
"client key generator",
"client key refresh",
"laravel",
"laravel apple",
"laravel socialite",
"oauth",
"provider",
"sign in with apple",
"socialite",
"socialite apple"
],
"support": {
"docs": "https://socialiteproviders.com/apple",
"issues": "https://github.com/socialiteproviders/providers/issues",
"source": "https://github.com/socialiteproviders/providers"
},
"time": "2023-05-03T22:50:09+00:00"
},
{
"name": "socialiteproviders/manager",
"version": "v4.3.0",
"source": {
"type": "git",
"url": "https://github.com/SocialiteProviders/Manager.git",
"reference": "47402cbc5b7ef445317e799bf12fd5a12062206c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/SocialiteProviders/Manager/zipball/47402cbc5b7ef445317e799bf12fd5a12062206c",
"reference": "47402cbc5b7ef445317e799bf12fd5a12062206c",
"shasum": ""
},
"require": {
"illuminate/support": "^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0",
"laravel/socialite": "~5.0",
"php": "^7.4 || ^8.0"
},
"require-dev": {
"mockery/mockery": "^1.2",
"phpunit/phpunit": "^6.0 || ^9.0"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"SocialiteProviders\\Manager\\ServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"SocialiteProviders\\Manager\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Andy Wendt",
"email": "andy@awendt.com"
},
{
"name": "Anton Komarev",
"email": "a.komarev@cybercog.su"
},
{
"name": "Miguel Piedrafita",
"email": "soy@miguelpiedrafita.com"
},
{
"name": "atymic",
"email": "atymicq@gmail.com",
"homepage": "https://atymic.dev"
}
],
"description": "Easily add new or override built-in providers in Laravel Socialite.",
"homepage": "https://socialiteproviders.com",
"keywords": [
"laravel",
"manager",
"oauth",
"providers",
"socialite"
],
"support": {
"issues": "https://github.com/socialiteproviders/manager/issues",
"source": "https://github.com/socialiteproviders/manager"
},
"time": "2023-01-26T23:11:27+00:00"
},
{ {
"name": "symfony/console", "name": "symfony/console",
"version": "v6.3.0", "version": "v6.3.0",
...@@ -5055,6 +5615,67 @@ ...@@ -5055,6 +5615,67 @@
], ],
"time": "2023-03-21T21:06:29+00:00" "time": "2023-03-21T21:06:29+00:00"
}, },
{
"name": "symfony/thanks",
"version": "v1.2.10",
"source": {
"type": "git",
"url": "https://github.com/symfony/thanks.git",
"reference": "e9c4709560296acbd4fe9e12b8d57a925aa7eae8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/thanks/zipball/e9c4709560296acbd4fe9e12b8d57a925aa7eae8",
"reference": "e9c4709560296acbd4fe9e12b8d57a925aa7eae8",
"shasum": ""
},
"require": {
"composer-plugin-api": "^1.0|^2.0",
"php": ">=5.5.9"
},
"type": "composer-plugin",
"extra": {
"branch-alias": {
"dev-main": "1.2-dev"
},
"class": "Symfony\\Thanks\\Thanks"
},
"autoload": {
"psr-4": {
"Symfony\\Thanks\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
}
],
"description": "Encourages sending ⭐ and 💵 to fellow PHP package maintainers (not limited to Symfony components)!",
"support": {
"issues": "https://github.com/symfony/thanks/issues",
"source": "https://github.com/symfony/thanks/tree/v1.2.10"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-10-14T17:47:37+00:00"
},
{ {
"name": "symfony/translation", "name": "symfony/translation",
"version": "v6.3.0", "version": "v6.3.0",
......
...@@ -37,16 +37,16 @@ return [ ...@@ -37,16 +37,16 @@ return [
'redirect' => env('GOOGLE_REDIRECT'), 'redirect' => env('GOOGLE_REDIRECT'),
], ],
'apple' => [
'client_id' => env('APPLE_CLIENT_ID'),
'client_secret' => env('APPLE_CLIENT_SECRET'),
'redirect' => env('APPLE_REDIRECT'),
],
'facebook' => [ 'facebook' => [
'client_id' => env('FACEBOOK_CLIENT_ID'), 'client_id' => env('FACEBOOK_CLIENT_ID'),
'client_secret' => env('FACEBOOK_CLIENT_SECRET'), 'client_secret' => env('FACEBOOK_CLIENT_SECRET'),
'redirect' => env('FACEBOOK_REDIRECT'), 'redirect' => env('FACEBOOK_REDIRECT'),
], ],
'apple' => [
'client_id' => env('APPLE_CLIENT_ID'),
'client_secret' => env('APPLE_CLIENT_SECRET'),
'redirect' => env('APPLE_REDIRECT')
],
]; ];
@extends('layouts.layout')
@section('content')
<!-- ======= Auth Section ======= -->
<section id="auth" class="auth">
<div class="container">
<h4>Авторизацiя</h4>
<p>Виконайте вхiд</p>
<form method="post" action="{{ route('register.store') }}">
@csrf
<div class="form-group">
<label for='email'>email</label>
<input class="form-control" type="email" id="email" name="email">
</div>
<div class="form-group">
<label for='name'>Ваше имя</label>
<input class="form-control" type="password" id="password" name="password">
</div>
<input class="btn btn-primary" type="submit" value="Вхiд">
</form>
<a class="" href="{{ route('register.create') }}">Регiстрацiя</a>
</div>
</section><!-- End Auth Section -->
@endsection
\ No newline at end of file
...@@ -29,7 +29,9 @@ ...@@ -29,7 +29,9 @@
<a class="" href="{{ route('login.google') }}">Войти через Google</a><br> <a class="" href="{{ route('login.google') }}">Войти через Google</a><br>
<a class="" href="{{ route('login.facebook') }}">Войти через Facebook</a><br> <a class="" href="{{ route('login.facebook') }}">Войти через Facebook</a><br>
@signInWithApple("black", true, "sign-in", 10)
</form> </form>
<a class="" href="{{ route('register.create') }}">Регiстрацiя</a> <a class="" href="{{ route('register.create') }}">Регiстрацiя</a>
......
...@@ -7,7 +7,37 @@ ...@@ -7,7 +7,37 @@
<section> <section>
<div class='container'> <div class='container'>
<h4>Налаштування {{ auth()->user()->name }}</h4> <h4>Налаштування</h4>
<form method="post" action="{{ route('settings.edit') }}">
@csrf
<div class="form-group">
<label for='name'>Ваше имя</label>
<input class="form-control" type="text" id="name" name="name" value="{{ auth()->user()->name }}">
</div>
<div class="form-group">
<label for='email'>Email address</label>
<input class="form-control" type="email" id="email" name="email" value="{{ auth()->user()->email }}">
</div>
<div class="form-group">
<label for='password'>Password</label>
<input class="form-control" type="password" id="password" name="password">
</div>
<div class="form-group">
<label for='password_confirmation'>Confirm password</label>
<input class="form-control" type="password" id="password_confirmation" name="password_confirmation">
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary">Зберiгти</button>
</div>
</form>
</div> </div>
</section> </section>
......
...@@ -5,6 +5,7 @@ namespace App\Http\Controllers; ...@@ -5,6 +5,7 @@ namespace App\Http\Controllers;
use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Route;
use Laravel\Socialite\Facades\Socialite; use Laravel\Socialite\Facades\Socialite;
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Web Routes | Web Routes
...@@ -27,6 +28,30 @@ Route::group(['middleware' => 'guest'], function(){ ...@@ -27,6 +28,30 @@ Route::group(['middleware' => 'guest'], function(){
Route::post('/register', [UserController::class, 'store']) -> name('register.store'); Route::post('/register', [UserController::class, 'store']) -> name('register.store');
Route::get('/login', [UserController::class, 'loginForm']) -> name('login.create'); Route::get('/login', [UserController::class, 'loginForm']) -> name('login.create');
Route::post('/login', [UserController::class, 'login']) -> name('login'); Route::post('/login', [UserController::class, 'login']) -> name('login');
//Auth Google
Route::get('/login/google', function () {
return Socialite::driver('google')->redirect();
}) -> name('login.google');
Route::get('/login/google/callback', [UserController::class, 'loginGoogle']);
//Auth Facebook
Route::get('login/facebook', function () {
return Socialite::driver('facebook')->redirect();
}) -> name('login.facebook');
Route::get('/login/facebook/callback', [UserController::class, 'loginFacebook']);
//Auth Apple
Route::get('login/apple', function () {
return Socialite::driver('apple')->redirect();
//return Socialite::driver("sign-in-with-apple")->scopes(["name", "email"])->redirect();
}) -> name('login.apple');
Route::post('login/apple/callback', function () {
$user = Socialite::driver('apple')->user();
//$user = Socialite::driver("sign-in-with-apple")->user();
dd($user);
});
}); });
...@@ -34,38 +59,7 @@ Route::group(['middleware' => 'auth'], function(){ ...@@ -34,38 +59,7 @@ Route::group(['middleware' => 'auth'], function(){
Route::get('/logout', [UserController::class, 'logout']) -> name('logout'); Route::get('/logout', [UserController::class, 'logout']) -> name('logout');
Route::get('/settings', [UserController::class, 'settings']) -> name('settings'); Route::get('/settings', [UserController::class, 'settings']) -> name('settings');
Route::post('/settings', [UserController::class, 'edit']) -> name('settings.edit');
}); });
//Auth Google
Route::get('/login/google', function () {
return Socialite::driver('google')->redirect();
}) -> name('login.google');
Route::get('/login/google/callback', [UserController::class, 'loginGoogle']) -> name('register.store');
//Auth Facebook
Route::get('login/facebook', function () {
return Socialite::driver('facebook')->redirect();
}) -> name('login.facebook');
Route::get('login/facebook/callback', function () {
$user = Socialite::driver('facebook')->user();
// $user->token
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment