social-login: Show social login linked status icon at user profile page
@00eb71200e6974e72b5faa07959f4c581888cc16
--- app/assets/stylesheets/less/_page.less
+++ app/assets/stylesheets/less/_page.less
... | ... | @@ -4673,6 +4673,7 @@ |
4673 | 4673 |
font-size: 14px; |
4674 | 4674 |
font-weight:bold; |
4675 | 4675 |
color:@primary; |
4676 |
+ margin-left: 5px; |
|
4676 | 4677 |
} |
4677 | 4678 |
} |
4678 | 4679 |
|
... | ... | @@ -6652,3 +6653,9 @@ |
6652 | 6653 |
margin-bottom: 3px; |
6653 | 6654 |
} |
6654 | 6655 |
} |
6656 |
+ |
|
6657 |
+.providers { |
|
6658 |
+ .provider-name { |
|
6659 |
+ height: 40px; |
|
6660 |
+ } |
|
6661 |
+} |
--- app/models/UserCredential.java
+++ app/models/UserCredential.java
... | ... | @@ -139,4 +139,7 @@ |
139 | 139 |
return LinkedAccount.findByProviderKey(this, providerKey); |
140 | 140 |
} |
141 | 141 |
|
142 |
+ public static List<UserCredential> findByUserId(Long id){ |
|
143 |
+ return find.where().eq("user.id", id).findList(); |
|
144 |
+ } |
|
142 | 145 |
} |
--- app/utils/TemplateHelper.scala
+++ app/utils/TemplateHelper.scala
... | ... | @@ -34,6 +34,23 @@ |
34 | 34 |
"</div>" |
35 | 35 |
} |
36 | 36 |
|
37 |
+ def GithubLogo: String = {"""<span class="github"><svg aria-hidden="true" height="24" version="1.1" viewBox="0 0 16 16" width="19"><path |
|
38 |
+ d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59 0.4 0.07 0.55-0.17 0.55-0.38 0-0.19-0.01-0.82-0.01-1.49-2.01 0.37-2.53-0.49-2.69-0.94-0.09-0.23-0.48-0.94-0.82-1.13-0.28-0.15-0.68-0.52-0.01-0.53 0.63-0.01 1.08 0.58 1.23 0.82 0.72 1.21 1.87 0.87 2.33 0.66 0.07-0.52 0.28-0.87 0.51-1.07-1.78-0.2-3.64-0.89-3.64-3.95 0-0.87 0.31-1.59 0.82-2.15-0.08-0.2-0.36-1.02 0.08-2.12 0 0 0.67-0.21 2.2 0.82 0.64-0.18 1.32-0.27 2-0.27 0.68 0 1.36 0.09 2 0.27 1.53-1.04 2.2-0.82 2.2-0.82 0.44 1.1 0.16 1.92 0.08 2.12 0.51 0.56 0.82 1.27 0.82 2.15 0 3.07-1.87 3.75-3.65 3.95 0.29 0.25 0.54 0.73 0.54 1.48 0 1.07-0.01 1.93-0.01 2.2 0 0.21 0.15 0.46 0.55 0.38C13.71 14.53 16 11.53 16 8 16 3.58 12.42 0 8 0z"></path></svg></span>"""} |
|
39 |
+ |
|
40 |
+ def GoogleLogo: String = { |
|
41 |
+ val url = routes.Assets.at("images/provider-logo/btn_google_light_normal_ios.svg") |
|
42 |
+ s"""<span class="google"><img src="$url"></span>""" |
|
43 |
+ } |
|
44 |
+ |
|
45 |
+ def providerWithLogo(provider:String): String = { |
|
46 |
+ val googleLogo = routes.Assets.at("images/provider-logo/btn_google_light_normal_ios.svg") |
|
47 |
+ provider match { |
|
48 |
+ case "github" => s"""<span class="auth-provider-logo">$GithubLogo <span class="provider-name">Sign in with Github</span></span>""" |
|
49 |
+ case "google" => s"""<span class="auth-provider-logo"><img src="$googleLogo" alt="login with Google"> Sign in with Google</span>""" |
|
50 |
+ case _ => "" |
|
51 |
+ } |
|
52 |
+ } |
|
53 |
+ |
|
37 | 54 |
def buildQueryString(call: Call, queryMap: Map[String, String]): String = { |
38 | 55 |
val baseUrl = call.toString |
39 | 56 |
var prefix = "?" |
--- app/views/common/loginDialog.scala.html
+++ app/views/common/loginDialog.scala.html
... | ... | @@ -6,13 +6,12 @@ |
6 | 6 |
**@ |
7 | 7 |
@() |
8 | 8 |
@import com.feth.play.module.pa.views.html._ |
9 |
+@import utils.TemplateHelper._ |
|
9 | 10 |
|
10 | 11 |
@providerWithLogo(provider:String) = @{ |
11 | 12 |
val googleLogo = routes.Assets.at("images/provider-logo/btn_google_light_normal_ios.svg") |
12 |
- val githubLogo = routes.Assets.at("images/provider-logo/github.svg") |
|
13 | 13 |
provider match { |
14 |
- case "github" => s"""<span class="auth-provider-logo"><span class="github"><svg aria-hidden="true" height="24" version="1.1" viewBox="0 0 16 16" width="20"><path |
|
15 |
- d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59 0.4 0.07 0.55-0.17 0.55-0.38 0-0.19-0.01-0.82-0.01-1.49-2.01 0.37-2.53-0.49-2.69-0.94-0.09-0.23-0.48-0.94-0.82-1.13-0.28-0.15-0.68-0.52-0.01-0.53 0.63-0.01 1.08 0.58 1.23 0.82 0.72 1.21 1.87 0.87 2.33 0.66 0.07-0.52 0.28-0.87 0.51-1.07-1.78-0.2-3.64-0.89-3.64-3.95 0-0.87 0.31-1.59 0.82-2.15-0.08-0.2-0.36-1.02 0.08-2.12 0 0 0.67-0.21 2.2 0.82 0.64-0.18 1.32-0.27 2-0.27 0.68 0 1.36 0.09 2 0.27 1.53-1.04 2.2-0.82 2.2-0.82 0.44 1.1 0.16 1.92 0.08 2.12 0.51 0.56 0.82 1.27 0.82 2.15 0 3.07-1.87 3.75-3.65 3.95 0.29 0.25 0.54 0.73 0.54 1.48 0 1.07-0.01 1.93-0.01 2.2 0 0.21 0.15 0.46 0.55 0.38C13.71 14.53 16 11.53 16 8 16 3.58 12.42 0 8 0z"></path></svg></span> <span class="provider-name">Sign in with Github</span></span>""" |
|
14 |
+ case "github" => s"""<span class="auth-provider-logo">$GithubLogo <span class="provider-name">Sign in with Github</span></span>""" |
|
16 | 15 |
case "google" => s"""<span class="auth-provider-logo"><img src="$googleLogo" alt="login with Google"> Sign in with Google</span>""" |
17 | 16 |
case _ => "" |
18 | 17 |
} |
--- app/views/user/login.scala.html
+++ app/views/user/login.scala.html
... | ... | @@ -9,17 +9,7 @@ |
9 | 9 |
@import com.feth.play.module.pa.views.html._ |
10 | 10 |
@import com.feth.play.module.pa.PlayAuthenticate._; |
11 | 11 |
@import play.mvc.Http._; |
12 |
- |
|
13 |
-@providerWithLogo(provider:String) = @{ |
|
14 |
- val googleLogo = routes.Assets.at("images/provider-logo/btn_google_light_normal_ios.svg") |
|
15 |
- val githubLogo = routes.Assets.at("images/provider-logo/github.svg") |
|
16 |
- provider match { |
|
17 |
- case "github" => s"""<span class="auth-provider-logo"><span class="github"><svg aria-hidden="true" height="24" version="1.1" viewBox="0 0 16 16" width="20"><path |
|
18 |
- d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59 0.4 0.07 0.55-0.17 0.55-0.38 0-0.19-0.01-0.82-0.01-1.49-2.01 0.37-2.53-0.49-2.69-0.94-0.09-0.23-0.48-0.94-0.82-1.13-0.28-0.15-0.68-0.52-0.01-0.53 0.63-0.01 1.08 0.58 1.23 0.82 0.72 1.21 1.87 0.87 2.33 0.66 0.07-0.52 0.28-0.87 0.51-1.07-1.78-0.2-3.64-0.89-3.64-3.95 0-0.87 0.31-1.59 0.82-2.15-0.08-0.2-0.36-1.02 0.08-2.12 0 0 0.67-0.21 2.2 0.82 0.64-0.18 1.32-0.27 2-0.27 0.68 0 1.36 0.09 2 0.27 1.53-1.04 2.2-0.82 2.2-0.82 0.44 1.1 0.16 1.92 0.08 2.12 0.51 0.56 0.82 1.27 0.82 2.15 0 3.07-1.87 3.75-3.65 3.95 0.29 0.25 0.54 0.73 0.54 1.48 0 1.07-0.01 1.93-0.01 2.2 0 0.21 0.15 0.46 0.55 0.38C13.71 14.53 16 11.53 16 8 16 3.58 12.42 0 8 0z"></path></svg></span> <span class="provider-name">Sign in with Github</span></span>""" |
|
19 |
- case "google" => s"""<span class="auth-provider-logo"><img src="$googleLogo" alt="login with Google"> Sign in with Google</span>""" |
|
20 |
- case _ => "" |
|
21 |
- } |
|
22 |
-} |
|
12 |
+@import utils.TemplateHelper._ |
|
23 | 13 |
|
24 | 14 |
@siteLayout(message, utils.MenuType.NONE) { |
25 | 15 |
<div class="page full"> |
--- app/views/user/view.scala.html
+++ app/views/user/view.scala.html
... | ... | @@ -1,22 +1,8 @@ |
1 | 1 |
@** |
2 |
-* Yobi, Project Hosting SW |
|
2 |
+* Yona, 21st Century Project Hosting SW |
|
3 | 3 |
* |
4 |
-* Copyright 2012 NAVER Corp. |
|
5 |
-* http://yobi.io |
|
6 |
-* |
|
7 |
-* @author Ahn Hyeok Jun |
|
8 |
-* |
|
9 |
-* Licensed under the Apache License, Version 2.0 (the "License"); |
|
10 |
-* you may not use this file except in compliance with the License. |
|
11 |
-* You may obtain a copy of the License at |
|
12 |
-* |
|
13 |
-* http://www.apache.org/licenses/LICENSE-2.0 |
|
14 |
-* |
|
15 |
-* Unless required by applicable law or agreed to in writing, software |
|
16 |
-* distributed under the License is distributed on an "AS IS" BASIS, |
|
17 |
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
18 |
-* See the License for the specific language governing permissions and |
|
19 |
-* limitations under the License. |
|
4 |
+* Copyright Yona & Yobi Authors & NAVER Corp. |
|
5 |
+* https://yona.io |
|
20 | 6 |
**@ |
21 | 7 |
@(user:User, groupNames:Array[String], projects:List[Project], postings:List[Posting], issues:List[Issue], pullRequests:List[PullRequest], milestones:List[Milestone], daysAgo:Int, selected:String) |
22 | 8 |
@import utils.MD5Util |
... | ... | @@ -30,6 +16,15 @@ |
30 | 16 |
@Html(emailAddress.reverse.replace("@","@<span class='z'>"+MD5Util.md5Hex(emailAddress)+"</span>").replace(".", "<span class='z'>"+MD5Util.md5Hex(emailAddress).reverse+"</span>.")) |
31 | 17 |
} |
32 | 18 |
@isActiveTab(tabId:String) = { @if(selected == tabId){ active } } |
19 |
+ |
|
20 |
+@providerImg(provider: String) = { |
|
21 |
+ @if(provider.equalsIgnoreCase("github")){ |
|
22 |
+ @Html(GithubLogo) |
|
23 |
+ } |
|
24 |
+ @if(provider.equalsIgnoreCase("google")){ |
|
25 |
+ @Html(GoogleLogo) |
|
26 |
+ } |
|
27 |
+} |
|
33 | 28 |
|
34 | 29 |
@siteLayout(user.loginId, utils.MenuType.USER) { |
35 | 30 |
<div class="site-breadcrumb-outer"> |
... | ... | @@ -70,6 +65,19 @@ |
70 | 65 |
<strong>@Messages("userinfo.since")</strong> |
71 | 66 |
<span class="since">@user.getDateString</span> |
72 | 67 |
</div> |
68 |
+ <div class="user-since"> |
|
69 |
+ <div> |
|
70 |
+ <strong>@Messages("user.connected.social.login")</strong> |
|
71 |
+ </div> |
|
72 |
+ <div class="auth-provider-logo"> |
|
73 |
+ @for(credential <- UserCredential.findByUserId(user.id)){ |
|
74 |
+ @for(provider <- credential.getProviders){ |
|
75 |
+ @providerImg(provider) |
|
76 |
+ } |
|
77 |
+ } |
|
78 |
+ </div> |
|
79 |
+ |
|
80 |
+ </div> |
|
73 | 81 |
</div> |
74 | 82 |
|
75 | 83 |
<div class="user-stream-box"> |
--- conf/messages
+++ conf/messages
... | ... | @@ -928,6 +928,7 @@ |
928 | 928 |
user.avatar.uploadError = Failed to upload. Please ask site admin |
929 | 929 |
user.confirmPassword = Confirm password |
930 | 930 |
user.confirmPassword.alert = This password doesn''t match the confirmation |
931 |
+user.connected.social.login = ??? ?? ??? |
|
931 | 932 |
user.currentPassword = Current password |
932 | 933 |
user.deleted = Deleted user account |
933 | 934 |
user.email = Email address |
--- conf/messages.ko-KR
+++ conf/messages.ko-KR
... | ... | @@ -918,6 +918,7 @@ |
918 | 918 |
user.avatar.uploadError = 아바타 이미지를 업로드 할 수 없었습니다.\n관리자에게 문의해주세요 |
919 | 919 |
user.confirmPassword = 비밀번호 확인 |
920 | 920 |
user.confirmPassword.alert = 입력한 두 비밀번호가 서로 일치하지 않습니다 |
921 |
+user.connected.social.login = 연결된 소셜 로그인 |
|
921 | 922 |
user.currentPassword = 현재 비밀번호 |
922 | 923 |
user.deleted = 삭제된 사용자 계정입니다. |
923 | 924 |
user.email = 이메일 |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?