Skip to content

Commit 6cfaed5

Browse files
committed
Use default account profile picture in fake authentication mode.
1 parent 5c7889b commit 6cfaed5

File tree

8 files changed

+20
-27
lines changed

8 files changed

+20
-27
lines changed

app/lib/account/models.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ class SessionData {
301301
/// Set image size to NxN pixels for faster loading, see:
302302
/// https://developers.google.com/people/image-sizing
303303
String imageUrlOfSize(int layoutSize) {
304-
if (imageUrl == null) {
304+
if (imageUrl == null || imageUrl == staticUrls.defaultProfilePng) {
305305
return staticUrls.defaultProfilePng;
306306
}
307307
// Double the layout size, for better quality on higher dpi displays.

app/lib/fake/backend/fake_auth_provider.dart

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import '../../account/auth_provider.dart';
2020
import '../../account/default_auth_provider.dart';
2121
import '../../account/session_cookie.dart';
2222
import '../../frontend/handlers/pubapi.client.dart';
23+
import '../../frontend/static_files.dart';
2324
import '../../service/openid/gcp_openid.dart';
2425
import '../../service/openid/github_openid.dart';
2526
import '../../service/openid/jwt.dart';
@@ -144,13 +145,9 @@ class FakeAuthProvider extends BaseAuthProvider {
144145
final name =
145146
email.split('@').first.replaceAll('-', ' ').replaceAll('.', ' ');
146147

147-
// gravatar image with retro face
148-
final emailMd5 = md5.convert(utf8.encode(email.trim())).toString();
149-
final imageUrl = 'https://www.gravatar.com/avatar/$emailMd5?d=retro&s=200';
150-
151148
return AccountProfile(
152149
name: name,
153-
imageUrl: imageUrl,
150+
imageUrl: staticUrls.defaultProfilePng,
154151
);
155152
}
156153

@@ -201,16 +198,12 @@ class FakeAuthProvider extends BaseAuthProvider {
201198
final name =
202199
email.split('@').first.replaceAll('-', ' ').replaceAll('.', ' ');
203200

204-
// gravatar image with retro face
205-
final emailMd5 = md5.convert(utf8.encode(email.trim())).toString();
206-
final imageUrl = 'https://www.gravatar.com/avatar/$emailMd5?d=retro&s=200';
207-
208201
return AuthResult(
209202
oauthUserId: token.payload['sub'] as String,
210203
email: email,
211204
audience: token.payload['aud'] as String,
212205
name: name,
213-
imageUrl: imageUrl,
206+
imageUrl: staticUrls.defaultProfilePng,
214207
accessToken: _createGcpToken(
215208
email: email,
216209
audience: activeConfiguration.pubServerAudience!,

app/test/frontend/golden/my_activity_log_page.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,11 @@ <h3 class="foldable-button">
113113
</div>
114114
</div>
115115
<div class="nav-container nav-profile-container hoverable">
116-
<input class="nav-profile-img nav-profile-image-desktop" type="image" src="https://www.gravatar.com/avatar/92c525024f1911332fe1d0f7dd750977?d=retro&amp;s=200" alt="Profile Image"/>
116+
<input class="nav-profile-img nav-profile-image-desktop" type="image" src="/static/hash-%%etag%%/img/material-icon-twotone-account-circle-white-24dp.png" alt="Profile Image"/>
117117
<div class="nav-hover-popup">
118118
<div class="nav-table-column">
119119
<div class="nav-account-title-mobile">
120-
<img class="nav-profile-img nav-profile-img-mobile" src="https://www.gravatar.com/avatar/92c525024f1911332fe1d0f7dd750977?d=retro&amp;s=200" alt="Profile Image" width="30" height="30"/>
120+
<img class="nav-profile-img nav-profile-img-mobile" src="/static/hash-%%etag%%/img/material-icon-twotone-account-circle-white-24dp.png" alt="Profile Image" width="30" height="30"/>
121121
<div class="nav-account-title">
122122
<div class="nav-account-name">admin</div>
123123
<div class="nav-account-email">[email protected]</div>
@@ -139,7 +139,7 @@ <h3 class="foldable-button">
139139
<div class="detail-container">
140140
<div class="detail-header-outer-block">
141141
<div class="detail-header-image-block">
142-
<img class="detail-header-image" src="https://www.gravatar.com/avatar/92c525024f1911332fe1d0f7dd750977?d=retro&amp;s=200=s400" alt="user profile picture" width="200" height="200"/>
142+
<img class="detail-header-image" src="/static/hash-%%etag%%/img/material-icon-twotone-account-circle-white-24dp.png" alt="user profile picture" width="200" height="200"/>
143143
</div>
144144
<div class="detail-header-content-block">
145145
<h1 class="title pub-monochrome-icon-hoverable">admin</h1>

app/test/frontend/golden/my_liked_packages.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,11 @@ <h3 class="foldable-button">
114114
</div>
115115
</div>
116116
<div class="nav-container nav-profile-container hoverable">
117-
<input class="nav-profile-img nav-profile-image-desktop" type="image" src="https://www.gravatar.com/avatar/f1983c9193966b63c29c141c02db9a34?d=retro&amp;s=200" alt="Profile Image"/>
117+
<input class="nav-profile-img nav-profile-image-desktop" type="image" src="/static/hash-%%etag%%/img/material-icon-twotone-account-circle-white-24dp.png" alt="Profile Image"/>
118118
<div class="nav-hover-popup">
119119
<div class="nav-table-column">
120120
<div class="nav-account-title-mobile">
121-
<img class="nav-profile-img nav-profile-img-mobile" src="https://www.gravatar.com/avatar/f1983c9193966b63c29c141c02db9a34?d=retro&amp;s=200" alt="Profile Image" width="30" height="30"/>
121+
<img class="nav-profile-img nav-profile-img-mobile" src="/static/hash-%%etag%%/img/material-icon-twotone-account-circle-white-24dp.png" alt="Profile Image" width="30" height="30"/>
122122
<div class="nav-account-title">
123123
<div class="nav-account-name">user</div>
124124
<div class="nav-account-email">[email protected]</div>
@@ -140,7 +140,7 @@ <h3 class="foldable-button">
140140
<div class="detail-container">
141141
<div class="detail-header-outer-block">
142142
<div class="detail-header-image-block">
143-
<img class="detail-header-image" src="https://www.gravatar.com/avatar/f1983c9193966b63c29c141c02db9a34?d=retro&amp;s=200=s400" alt="user profile picture" width="200" height="200"/>
143+
<img class="detail-header-image" src="/static/hash-%%etag%%/img/material-icon-twotone-account-circle-white-24dp.png" alt="user profile picture" width="200" height="200"/>
144144
</div>
145145
<div class="detail-header-content-block">
146146
<h1 class="title pub-monochrome-icon-hoverable">user</h1>

app/test/frontend/golden/my_packages.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,11 @@ <h3 class="foldable-button">
113113
</div>
114114
</div>
115115
<div class="nav-container nav-profile-container hoverable">
116-
<input class="nav-profile-img nav-profile-image-desktop" type="image" src="https://www.gravatar.com/avatar/f1983c9193966b63c29c141c02db9a34?d=retro&amp;s=200" alt="Profile Image"/>
116+
<input class="nav-profile-img nav-profile-image-desktop" type="image" src="/static/hash-%%etag%%/img/material-icon-twotone-account-circle-white-24dp.png" alt="Profile Image"/>
117117
<div class="nav-hover-popup">
118118
<div class="nav-table-column">
119119
<div class="nav-account-title-mobile">
120-
<img class="nav-profile-img nav-profile-img-mobile" src="https://www.gravatar.com/avatar/f1983c9193966b63c29c141c02db9a34?d=retro&amp;s=200" alt="Profile Image" width="30" height="30"/>
120+
<img class="nav-profile-img nav-profile-img-mobile" src="/static/hash-%%etag%%/img/material-icon-twotone-account-circle-white-24dp.png" alt="Profile Image" width="30" height="30"/>
121121
<div class="nav-account-title">
122122
<div class="nav-account-name">user</div>
123123
<div class="nav-account-email">[email protected]</div>
@@ -139,7 +139,7 @@ <h3 class="foldable-button">
139139
<div class="detail-container">
140140
<div class="detail-header-outer-block">
141141
<div class="detail-header-image-block">
142-
<img class="detail-header-image" src="https://www.gravatar.com/avatar/f1983c9193966b63c29c141c02db9a34?d=retro&amp;s=200=s400" alt="user profile picture" width="200" height="200"/>
142+
<img class="detail-header-image" src="/static/hash-%%etag%%/img/material-icon-twotone-account-circle-white-24dp.png" alt="user profile picture" width="200" height="200"/>
143143
</div>
144144
<div class="detail-header-content-block">
145145
<h1 class="title pub-monochrome-icon-hoverable">user</h1>

app/test/frontend/golden/my_publishers.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,11 @@ <h3 class="foldable-button">
113113
</div>
114114
</div>
115115
<div class="nav-container nav-profile-container hoverable">
116-
<input class="nav-profile-img nav-profile-image-desktop" type="image" src="https://www.gravatar.com/avatar/f1983c9193966b63c29c141c02db9a34?d=retro&amp;s=200" alt="Profile Image"/>
116+
<input class="nav-profile-img nav-profile-image-desktop" type="image" src="/static/hash-%%etag%%/img/material-icon-twotone-account-circle-white-24dp.png" alt="Profile Image"/>
117117
<div class="nav-hover-popup">
118118
<div class="nav-table-column">
119119
<div class="nav-account-title-mobile">
120-
<img class="nav-profile-img nav-profile-img-mobile" src="https://www.gravatar.com/avatar/f1983c9193966b63c29c141c02db9a34?d=retro&amp;s=200" alt="Profile Image" width="30" height="30"/>
120+
<img class="nav-profile-img nav-profile-img-mobile" src="/static/hash-%%etag%%/img/material-icon-twotone-account-circle-white-24dp.png" alt="Profile Image" width="30" height="30"/>
121121
<div class="nav-account-title">
122122
<div class="nav-account-name">user</div>
123123
<div class="nav-account-email">[email protected]</div>
@@ -139,7 +139,7 @@ <h3 class="foldable-button">
139139
<div class="detail-container">
140140
<div class="detail-header-outer-block">
141141
<div class="detail-header-image-block">
142-
<img class="detail-header-image" src="https://www.gravatar.com/avatar/f1983c9193966b63c29c141c02db9a34?d=retro&amp;s=200=s400" alt="user profile picture" width="200" height="200"/>
142+
<img class="detail-header-image" src="/static/hash-%%etag%%/img/material-icon-twotone-account-circle-white-24dp.png" alt="user profile picture" width="200" height="200"/>
143143
</div>
144144
<div class="detail-header-content-block">
145145
<h1 class="title pub-monochrome-icon-hoverable">user</h1>

app/test/frontend/golden/pkg_activity_log_page.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,11 @@ <h3 class="foldable-button">
115115
</div>
116116
</div>
117117
<div class="nav-container nav-profile-container hoverable">
118-
<input class="nav-profile-img nav-profile-image-desktop" type="image" src="https://www.gravatar.com/avatar/92c525024f1911332fe1d0f7dd750977?d=retro&amp;s=200" alt="Profile Image"/>
118+
<input class="nav-profile-img nav-profile-image-desktop" type="image" src="/static/hash-%%etag%%/img/material-icon-twotone-account-circle-white-24dp.png" alt="Profile Image"/>
119119
<div class="nav-hover-popup">
120120
<div class="nav-table-column">
121121
<div class="nav-account-title-mobile">
122-
<img class="nav-profile-img nav-profile-img-mobile" src="https://www.gravatar.com/avatar/92c525024f1911332fe1d0f7dd750977?d=retro&amp;s=200" alt="Profile Image" width="30" height="30"/>
122+
<img class="nav-profile-img nav-profile-img-mobile" src="/static/hash-%%etag%%/img/material-icon-twotone-account-circle-white-24dp.png" alt="Profile Image" width="30" height="30"/>
123123
<div class="nav-account-title">
124124
<div class="nav-account-name">admin</div>
125125
<div class="nav-account-email">[email protected]</div>

app/test/frontend/golden/pkg_admin_page.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,11 @@ <h3 class="foldable-button">
115115
</div>
116116
</div>
117117
<div class="nav-container nav-profile-container hoverable">
118-
<input class="nav-profile-img nav-profile-image-desktop" type="image" src="https://www.gravatar.com/avatar/92c525024f1911332fe1d0f7dd750977?d=retro&amp;s=200" alt="Profile Image"/>
118+
<input class="nav-profile-img nav-profile-image-desktop" type="image" src="/static/hash-%%etag%%/img/material-icon-twotone-account-circle-white-24dp.png" alt="Profile Image"/>
119119
<div class="nav-hover-popup">
120120
<div class="nav-table-column">
121121
<div class="nav-account-title-mobile">
122-
<img class="nav-profile-img nav-profile-img-mobile" src="https://www.gravatar.com/avatar/92c525024f1911332fe1d0f7dd750977?d=retro&amp;s=200" alt="Profile Image" width="30" height="30"/>
122+
<img class="nav-profile-img nav-profile-img-mobile" src="/static/hash-%%etag%%/img/material-icon-twotone-account-circle-white-24dp.png" alt="Profile Image" width="30" height="30"/>
123123
<div class="nav-account-title">
124124
<div class="nav-account-name">admin</div>
125125
<div class="nav-account-email">[email protected]</div>

0 commit comments

Comments
 (0)