Skip to content

Commit c8202bb

Browse files
authored
Use default account profile picture in fake authentication mode. (#8583)
1 parent 5c7889b commit c8202bb

File tree

8 files changed

+20
-28
lines changed

8 files changed

+20
-28
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 & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import 'dart:convert';
88

99
import 'package:clock/clock.dart';
10-
import 'package:crypto/crypto.dart';
1110
import 'package:gcloud/service_scope.dart' as ss;
1211
import 'package:googleapis/oauth2/v2.dart' as oauth2_v2;
1312
import 'package:http/http.dart' as http;
@@ -20,6 +19,7 @@ import '../../account/auth_provider.dart';
2019
import '../../account/default_auth_provider.dart';
2120
import '../../account/session_cookie.dart';
2221
import '../../frontend/handlers/pubapi.client.dart';
22+
import '../../frontend/static_files.dart';
2323
import '../../service/openid/gcp_openid.dart';
2424
import '../../service/openid/github_openid.dart';
2525
import '../../service/openid/jwt.dart';
@@ -144,13 +144,9 @@ class FakeAuthProvider extends BaseAuthProvider {
144144
final name =
145145
email.split('@').first.replaceAll('-', ' ').replaceAll('.', ' ');
146146

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-
151147
return AccountProfile(
152148
name: name,
153-
imageUrl: imageUrl,
149+
imageUrl: staticUrls.defaultProfilePng,
154150
);
155151
}
156152

@@ -201,16 +197,12 @@ class FakeAuthProvider extends BaseAuthProvider {
201197
final name =
202198
email.split('@').first.replaceAll('-', ' ').replaceAll('.', ' ');
203199

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-
208200
return AuthResult(
209201
oauthUserId: token.payload['sub'] as String,
210202
email: email,
211203
audience: token.payload['aud'] as String,
212204
name: name,
213-
imageUrl: imageUrl,
205+
imageUrl: staticUrls.defaultProfilePng,
214206
accessToken: _createGcpToken(
215207
email: email,
216208
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)