Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into people
Browse files Browse the repository at this point in the history
# Conflicts:
#	pubspec.lock
#	pubspec.yaml
  • Loading branch information
IoanaAlexandru committed Sep 16, 2020
2 parents aec8904 + d83dd62 commit c9c0688
Show file tree
Hide file tree
Showing 4 changed files with 197 additions and 55 deletions.
2 changes: 2 additions & 0 deletions lib/authentication/model/user.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class User {
String year;
String series;
String group;
String subgroup;

int permissionLevel;

Expand All @@ -23,6 +24,7 @@ class User {
this.year,
this.series,
this.group,
this.subgroup,
int permissionLevel})
: this.permissionLevel = permissionLevel ?? 0;

Expand Down
12 changes: 10 additions & 2 deletions lib/authentication/service/auth_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ extension DatabaseUser on User {
String year;
String series;
String group;
String subgroup;
if (snap.data.containsKey('class')) {
degree = snap.data['class']['degree'];
domain = snap.data['class']['domain'];
year = snap.data['class']['year'];
series = snap.data['class']['series'];
group = snap.data['class']['group'];
subgroup = snap.data['class']['subgroup'];
}

return User(
Expand All @@ -46,6 +48,7 @@ extension DatabaseUser on User {
year: year,
series: series,
group: group,
subgroup: subgroup,
permissionLevel: snap.data['permissionLevel']);
}

Expand All @@ -56,6 +59,7 @@ extension DatabaseUser on User {
if (year != null) classInfo['year'] = year;
if (series != null) classInfo['series'] = series;
if (group != null) classInfo['group'] = group;
if (subgroup != null) classInfo['subgroup'] = subgroup;

return {
'name': {'first': firstName, 'last': lastName},
Expand Down Expand Up @@ -342,6 +346,8 @@ class AuthProvider with ChangeNotifier {
filter.localizedLevelNames[3][LocaleProvider.localeString]);
String group = info.getIfPresent(
filter.localizedLevelNames[4][LocaleProvider.localeString]);
String subgroup = info.getIfPresent(
filter.localizedLevelNames[5][LocaleProvider.localeString]);

if (email == null || email == '') {
AppToast.show(S.of(context).errorInvalidEmail);
Expand All @@ -362,7 +368,8 @@ class AuthProvider with ChangeNotifier {
AppToast.show(S.of(context).errorMissingLastName);
return false;
}
if (!await AppValidator.isStrongPassword(password: password, context: context)) {
if (!await AppValidator.isStrongPassword(
password: password, context: context)) {
return false;
}

Expand All @@ -388,7 +395,8 @@ class AuthProvider with ChangeNotifier {
domain: domain,
year: year,
series: series,
group: group);
group: group,
subgroup: subgroup);

DocumentReference ref =
Firestore.instance.collection('users').document(user.uid);
Expand Down
1 change: 0 additions & 1 deletion lib/generated/l10n.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c9c0688

Please sign in to comment.