Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Зуев Егор
/
wiki.dev
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Authored by
Dan Brown
2017-02-05 15:28:53 +0000
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Commit
86625a7642e437d3f0b68543747036e25ff94912
86625a76
1 parent
ee495450
Neatened up social login/register buttons
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
67 additions
and
30 deletions
app/Services/SocialAuthService.php
config/services.php
resources/assets/sass/_buttons.scss
resources/assets/sass/_grid.scss
resources/assets/sass/styles.scss
resources/lang/en/auth.php
resources/views/auth/login.blade.php
resources/views/auth/register.blade.php
app/Services/SocialAuthService.php
View file @
86625a7
...
...
@@ -181,15 +181,25 @@ class SocialAuthService
public
function
getActiveDrivers
()
{
$activeDrivers
=
[];
foreach
(
$this
->
validSocialDrivers
as
$driver
Name
)
{
if
(
$this
->
checkDriverConfigured
(
$driver
Name
))
{
$activeDrivers
[
$driver
Name
]
=
true
;
foreach
(
$this
->
validSocialDrivers
as
$driver
Key
)
{
if
(
$this
->
checkDriverConfigured
(
$driver
Key
))
{
$activeDrivers
[
$driver
Key
]
=
$this
->
getDriverName
(
$driverKey
)
;
}
}
return
$activeDrivers
;
}
/**
* Get the presentational name for a driver.
* @param $driver
* @return mixed
*/
public
function
getDriverName
(
$driver
)
{
return
config
(
'services.'
.
strtolower
(
$driver
)
.
'.name'
);
}
/**
* @param string $socialDriver
* @param \Laravel\Socialite\Contracts\User $socialUser
* @return SocialAccount
...
...
config/services.php
View file @
86625a7
...
...
@@ -41,30 +41,35 @@ return [
'client_id'
=>
env
(
'GITHUB_APP_ID'
,
false
),
'client_secret'
=>
env
(
'GITHUB_APP_SECRET'
,
false
),
'redirect'
=>
env
(
'APP_URL'
)
.
'/login/service/github/callback'
,
'name'
=>
'GitHub'
,
],
'google'
=>
[
'client_id'
=>
env
(
'GOOGLE_APP_ID'
,
false
),
'client_secret'
=>
env
(
'GOOGLE_APP_SECRET'
,
false
),
'redirect'
=>
env
(
'APP_URL'
)
.
'/login/service/google/callback'
,
'name'
=>
'Google'
,
],
'slack'
=>
[
'client_id'
=>
env
(
'SLACK_APP_ID'
,
false
),
'client_secret'
=>
env
(
'SLACK_APP_SECRET'
,
false
),
'redirect'
=>
env
(
'APP_URL'
)
.
'/login/service/slack/callback'
,
'name'
=>
'Slack'
,
],
'facebook'
=>
[
'client_id'
=>
env
(
'FACEBOOK_APP_ID'
,
false
),
'client_secret'
=>
env
(
'FACEBOOK_APP_SECRET'
,
false
),
'redirect'
=>
env
(
'APP_URL'
)
.
'/login/service/facebook/callback'
,
'name'
=>
'Facebook'
,
],
'twitter'
=>
[
'client_id'
=>
env
(
'TWITTER_APP_ID'
,
false
),
'client_secret'
=>
env
(
'TWITTER_APP_SECRET'
,
false
),
'redirect'
=>
env
(
'APP_URL'
)
.
'/login/service/twitter/callback'
,
'name'
=>
'Twitter'
,
],
'ldap'
=>
[
...
...
resources/assets/sass/_buttons.scss
View file @
86625a7
...
...
@@ -54,6 +54,9 @@ $button-border-radius: 2px;
&
.muted
{
@include
generate-button-colors
(
#EEE
,
#888
);
}
&
.muted-light
{
@include
generate-button-colors
(
#666
,
#e4e4e4
);
}
}
.text-button
{
...
...
@@ -92,6 +95,9 @@ $button-border-radius: 2px;
width
:
100%
;
text-align
:
center
;
display
:
block
;
&
.text-left
{
text-align
:
left
;
}
}
.button.icon
{
...
...
@@ -100,6 +106,19 @@ $button-border-radius: 2px;
}
}
.button.svg
{
svg
{
display
:
inline-block
;
position
:
absolute
;
left
:
$-m
;
top
:
$-s
-
2px
;
width
:
24px
;
}
padding
:
$-s
$-m
;
padding-bottom
:
$-s
-
2px
;
padding-left
:
$-m
*
2
+
24px
;
}
.button
[
disabled
]
{
background-color
:
#BBB
;
cursor
:
default
;
...
...
resources/assets/sass/_grid.scss
View file @
86625a7
...
...
@@ -55,20 +55,6 @@ div[class^="col-"] img {
}
}
.center-box
{
margin
:
$-xl
auto
0
auto
;
padding
:
$-m
$-xxl
$-xl
*
2
$-xxl
;
max-width
:
346px
;
display
:
inline-block
;
text-align
:
left
;
vertical-align
:
top
;
&
.login
{
background-color
:
#EEE
;
box-shadow
:
0
0
2px
0
rgba
(
0
,
0
,
0
,
0
.1
);
border
:
1px
solid
#DDD
;
}
}
.row
{
margin-left
:
-
$-m
;
margin-right
:
-
$-m
;
...
...
resources/assets/sass/styles.scss
View file @
86625a7
...
...
@@ -251,10 +251,24 @@ $btt-size: 40px;
}
}
.center-box
{
margin
:
$-xl
auto
0
auto
;
padding
:
$-m
$-xxl
$-xl
$-xxl
;
width
:
420px
;
max-width
:
100%
;
display
:
inline-block
;
text-align
:
left
;
vertical-align
:
top
;
//border: 1px solid #DDD;
input
{
width
:
100%
;
}
&
.login
{
background-color
:
#EEE
;
box-shadow
:
0
0
2px
0
rgba
(
0
,
0
,
0
,
0
.1
);
border
:
1px
solid
#DDD
;
}
}
...
...
resources/lang/en/auth.php
View file @
86625a7
...
...
@@ -18,6 +18,8 @@ return [
*/
'sign_up'
=>
'Sign up'
,
'log_in'
=>
'Log in'
,
'log_in_with'
=>
'Login with :socialDriver'
,
'sign_up_with'
=>
'Sign up with :socialDriver'
,
'logout'
=>
'Logout'
,
'name'
=>
'Name'
,
...
...
resources/views/auth/login.blade.php
View file @
86625a7
...
...
@@ -32,10 +32,11 @@
@if(count($socialDrivers) > 0)
<hr
class=
"margin-top"
>
<h3
class=
"text-muted"
>
{{ trans('auth.social_login') }}
</h3>
@foreach($socialDrivers as $driver => $enabled)
<a
id=
"social-login-{{$driver}}"
href=
"{{ baseUrl("
/
login
/
service
/"
.
$
driver
)
}}"
>
@icon($driver, ['width' => 56])
</a>
@foreach($socialDrivers as $driver => $name)
<a
id=
"social-login-{{$driver}}"
class=
"button block muted-light svg text-left"
href=
"{{ baseUrl("
/
login
/
service
/"
.
$
driver
)
}}"
>
@icon($driver)
{{ trans('auth.log_in_with', ['socialDriver' => $name]) }}
</a>
@endforeach
@endif
</div>
...
...
resources/views/auth/register.blade.php
View file @
86625a7
...
...
@@ -35,11 +35,11 @@
@if(count($socialDrivers) > 0)
<hr
class=
"margin-top"
>
<h3
class=
"text-muted"
>
{{ trans('auth.social_registration') }}
</h3>
<p
class=
"text-small"
>
{{ trans('auth.social_registration_text') }}
</p
>
@foreach($socialDrivers as $driver => $enabled
)
<a
href=
"{{ baseUrl("
/
register
/
service
/"
.
$
driver
)
}}"
>
@icon($driver, ['width' => 56])
</a>
@foreach($socialDrivers as $driver => $name)
<a
id=
"social-register-{{$driver}}"
class=
"button block muted-light svg text-left"
href=
"{{ baseUrl("
/
register
/
service
/"
.
$
driver
)
}}"
>
@icon($driver
)
{{ trans('auth.sign_up_with', ['socialDriver' => $name]) }}
</a>
@endforeach
@endif
</div>
...
...
Please
register
or
sign in
to post a comment