Skip to content

Commit 5a62f93

Browse files
authored
fix: users prevented from logging in (#1686)
* fix: support null value in sendQuincyEmail * chore: remove privacy terms page the privacy terms are now mentioned in the login page * fix: service test
1 parent fc596f3 commit 5a62f93

File tree

5 files changed

+61
-216
lines changed

5 files changed

+61
-216
lines changed

mobile-app/lib/models/main/user_model.dart

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ class FccUserModel {
3636

3737
final bool emailVerified;
3838
final bool isEmailVerified;
39-
final bool acceptedPrivacyTerms;
40-
final bool sendQuincyEmail;
39+
final bool? sendQuincyEmail;
4140

4241
final bool isCheater;
4342
final bool isDonating;
@@ -99,8 +98,7 @@ class FccUserModel {
9998
this.about,
10099
required this.emailVerified,
101100
required this.isEmailVerified,
102-
required this.acceptedPrivacyTerms,
103-
required this.sendQuincyEmail,
101+
this.sendQuincyEmail,
104102
required this.isCheater,
105103
required this.isDonating,
106104
required this.isHonest,
@@ -154,7 +152,6 @@ class FccUserModel {
154152
about: data['about'],
155153
emailVerified: data['emailVerified'],
156154
isEmailVerified: data['isEmailVerified'],
157-
acceptedPrivacyTerms: data['acceptedPrivacyTerms'],
158155
sendQuincyEmail: data['sendQuincyEmail'],
159156
isCheater: data['isCheater'],
160157
isDonating: data['isDonating'] ?? false,

mobile-app/lib/service/authentication/authentication_service.dart

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import 'package:freecodecamp/app/app.router.dart';
1212
import 'package:freecodecamp/extensions/i18n_extension.dart';
1313
import 'package:freecodecamp/models/main/user_model.dart';
1414
import 'package:freecodecamp/service/dio_service.dart';
15-
import 'package:freecodecamp/ui/views/auth/privacy_view.dart';
1615
import 'package:stacked_services/stacked_services.dart';
1716
import 'package:url_launcher/url_launcher.dart';
1817

@@ -318,33 +317,6 @@ class AuthenticationService {
318317
return false;
319318
}
320319

321-
final user = await userModel;
322-
323-
if (user != null && user.acceptedPrivacyTerms == false) {
324-
bool? quincyEmails = await Navigator.push(
325-
context,
326-
MaterialPageRoute(
327-
builder: (context) => const PrivacyView(),
328-
settings: const RouteSettings(
329-
name: '/new-user-accept-privacy',
330-
),
331-
),
332-
);
333-
334-
await _dio.put(
335-
'$baseApiURL/update-privacy-terms',
336-
data: {
337-
'quincyEmails': quincyEmails ?? false,
338-
},
339-
options: Options(
340-
headers: {
341-
'CSRF-Token': _csrfToken,
342-
'Cookie': 'jwt_access_token=$_jwtAccessToken; _csrf=$_csrf',
343-
},
344-
),
345-
);
346-
}
347-
348320
await auth0.credentialsManager.clearCredentials();
349321
// ignore: unnecessary_null_comparison
350322
if (res != null) {

mobile-app/lib/ui/views/auth/privacy_view.dart

Lines changed: 0 additions & 181 deletions
This file was deleted.

mobile-app/lib/ui/views/login/native_login_view.dart

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
import 'package:flutter/gestures.dart';
12
import 'package:flutter/material.dart';
23
import 'package:freecodecamp/extensions/i18n_extension.dart';
34
import 'package:freecodecamp/ui/theme/fcc_theme.dart';
45
import 'package:freecodecamp/ui/views/login/native_login_viewmodel.dart';
56
import 'package:freecodecamp/ui/widgets/drawer_widget/drawer_widget_view.dart';
67
import 'package:stacked/stacked.dart';
8+
import 'package:url_launcher/url_launcher.dart';
79

810
class NativeLoginView extends StatelessWidget {
911
const NativeLoginView({super.key, this.fromButton = false});
@@ -283,6 +285,62 @@ class NativeLoginView extends StatelessWidget {
283285
),
284286
)
285287
],
288+
),
289+
Row(
290+
children: [
291+
Expanded(
292+
child: Padding(
293+
padding: const EdgeInsets.all(8.0),
294+
child: RichText(
295+
textAlign: TextAlign.center,
296+
text: TextSpan(
297+
style: TextStyle(
298+
color: Colors.white.withValues(alpha: 0.87),
299+
),
300+
children: [
301+
TextSpan(
302+
text:
303+
"By continuing, you indicate that you have read and agree to freeCodeCamp.org's ",
304+
),
305+
TextSpan(
306+
text: 'Terms of Service',
307+
style: const TextStyle(
308+
decoration: TextDecoration.underline,
309+
),
310+
recognizer: TapGestureRecognizer()
311+
..onTap = () {
312+
launchUrl(
313+
Uri.parse(
314+
'https://www.freecodecamp.org/news/terms-of-service',
315+
),
316+
);
317+
},
318+
),
319+
TextSpan(
320+
text: ' and ',
321+
),
322+
TextSpan(
323+
text: 'Privacy Policy',
324+
style: const TextStyle(
325+
decoration: TextDecoration.underline,
326+
),
327+
recognizer: TapGestureRecognizer()
328+
..onTap = () {
329+
launchUrl(
330+
Uri.parse(
331+
'https://www.freecodecamp.org/news/privacy-policy',
332+
),
333+
);
334+
},
335+
),
336+
TextSpan(
337+
text: '.',
338+
),
339+
],
340+
),
341+
),
342+
)),
343+
],
286344
)
287345
],
288346
),

mobile-app/test/services/learn/daily_challenge_notification_service_test.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -655,8 +655,7 @@ FccUserModel createMockUser({
655655
currentChallengeId: '',
656656
emailVerified: true,
657657
isEmailVerified: true,
658-
acceptedPrivacyTerms: true,
659-
sendQuincyEmail: false,
658+
sendQuincyEmail: null,
660659
isCheater: false,
661660
isDonating: false,
662661
isHonest: true,

0 commit comments

Comments
 (0)