diff --git a/apiserver/apiserver/api/models.py b/apiserver/apiserver/api/models.py index e68c85c..b01ca2c 100644 --- a/apiserver/apiserver/api/models.py +++ b/apiserver/apiserver/api/models.py @@ -59,6 +59,7 @@ class Member(models.Model): monthly_fees = models.IntegerField(default=55, blank=True, null=True) is_allowed_entry = models.BooleanField(default=True) discourse_username = models.CharField(default='', max_length=40, blank=True, null=True) + mediawiki_username = models.CharField(default='', max_length=40, blank=True, null=True) allow_last_scanned = models.BooleanField(default=True) history = HistoricalRecords(excluded_fields=['member_forms']) diff --git a/apiserver/apiserver/api/serializers.py b/apiserver/apiserver/api/serializers.py index 32a8e2c..f60b8f6 100644 --- a/apiserver/apiserver/api/serializers.py +++ b/apiserver/apiserver/api/serializers.py @@ -208,6 +208,7 @@ class MemberSerializer(serializers.ModelSerializer): 'rabbit_cert_date', 'trotec_cert_date', 'is_allowed_entry', + 'mediawiki_username', ] def update(self, instance, validated_data): @@ -275,6 +276,7 @@ class AdminMemberSerializer(MemberSerializer): 'old_email', 'is_director', 'is_staff', + 'mediawiki_username', ] def update(self, instance, validated_data): @@ -624,6 +626,8 @@ class MyPasswordChangeSerializer(PasswordChangeSerializer): first_name=self.user.member.first_name, ) + data['username'] = self.user.member.mediawiki_username or self.user.username + if utils_auth.wiki_is_configured(): if request_id: utils_stats.set_progress(request_id, 'Changing Wiki password...') if utils_auth.set_wiki_password(data) != 200: @@ -687,6 +691,8 @@ class MyPasswordResetConfirmSerializer(PasswordResetConfirmSerializer): first_name=self.user.member.first_name, ) + data['username'] = self.user.member.mediawiki_username or self.user.username + if utils_auth.wiki_is_configured(): if request_id: utils_stats.set_progress(request_id, 'Changing Wiki password...') if utils_auth.set_wiki_password(data) != 200: @@ -761,6 +767,7 @@ class SpaceportAuthSerializer(LoginSerializer): data['email'] = user.email data['first_name'] = user.member.first_name + data['username'] = user.member.mediawiki_username or user.username utils_auth.set_wiki_password(data) data['username'] = user.member.discourse_username or user.username diff --git a/webclient/src/Account.js b/webclient/src/Account.js index fa1471e..827ea00 100644 --- a/webclient/src/Account.js +++ b/webclient/src/Account.js @@ -250,8 +250,13 @@ export function AccountForm(props) { {...makeProps('emergency_contact_phone')} /> + {member.mediawiki_username &&
+ +

{member.mediawiki_username}

+
} + {member.discourse_username && } diff --git a/webclient/src/Auth.js b/webclient/src/Auth.js index 7cb2adc..e2c8b85 100644 --- a/webclient/src/Auth.js +++ b/webclient/src/Auth.js @@ -110,7 +110,7 @@ export function AuthWiki(props) {
Success!

You can now log into the Wiki:

{user &&

- Username: {user.username}
+ Username: {user.member.mediawiki_username || user.username}
Password: [this Spaceport password]

}

Protospace Wiki