Compare commits

...

4 Commits

Author SHA1 Message Date
Phillip Thelen ed48e5e34c remove trailing space 2026-03-03 11:25:04 +01:00
Phillip Thelen c17db4ebcd fix lint 2026-03-03 10:43:22 +01:00
Phillip Thelen 7cc0696ee4 Add Web UI to set email if apple does not provide one 2026-02-27 16:51:41 +01:00
Phillip Thelen 4532105749 apply email passed via body if it is missing from apple profile 2026-02-25 12:06:15 +01:00
3 changed files with 32 additions and 9 deletions
@@ -43,6 +43,14 @@
<p class="purple-600">
{{ $t('usernameLimitations') }}
</p>
<input
v-if="needsEmailField"
id="emailInput"
v-model="email"
class="form-control dark"
type="text"
:placeholder="$t('email')"
>
<div class="custom-control custom-checkbox mb-4">
<input
id="privacyTOS"
@@ -165,6 +173,7 @@ export default {
registrationMethod: null,
username: '',
usernameIssues: [],
needsEmailField: false,
};
},
computed: {
@@ -183,22 +192,30 @@ export default {
},
},
mounted () {
if (window.sessionStorage.getItem('apple-token')) {
this.registrationMethod = 'apple';
} else if (!this.$store.state.registrationOptions.registrationMethod) {
this.$router.push('/');
} else {
this.registrationMethod = this.$store.state.registrationOptions.registrationMethod;
}
this.authData = this.$store.state.registrationOptions.authData;
this.email = this.$store.state.registrationOptions.email;
this.username = this.$store.state.registrationOptions.username;
this.password = this.$store.state.registrationOptions.password;
this.passwordConfirm = this.$store.state.registrationOptions.passwordConfirm;
if (!this.email) {
if (window.sessionStorage.getItem('apple-token')) {
this.registrationMethod = 'apple';
if (!this.email) {
this.email = window.sessionStorage.getItem('apple-email');
}
} else if (!this.$store.state.registrationOptions.registrationMethod) {
this.$router.push('/');
} else {
this.registrationMethod = this.$store.state.registrationOptions.registrationMethod;
}
if (!this.email && this.registrationMethod !== 'apple') {
return;
}
if ((!this.email || this.email === '') && this.registrationMethod === 'apple') {
this.needsEmailField = true;
}
const usernameToCheck = this.email.split('@')[0].replace(/[^a-zA-Z0-9\-_]/g, '');
this.$store.dispatch('auth:verifyUsername', {
username: usernameToCheck,
@@ -237,6 +254,7 @@ export default {
idToken: window.sessionStorage.getItem('apple-token'),
name: window.sessionStorage.getItem('apple-name'),
username: this.username,
email: this.email,
allowRegister: true,
});
} else {
@@ -37,6 +37,7 @@ export default {
window.location.href = '/';
} else {
window.sessionStorage.setItem('apple-token', response.idToken);
window.sessionStorage.setItem('apple-email', response.email);
window.location.href = '/username';
}
},
+5 -1
View File
@@ -44,9 +44,13 @@ export async function appleProfile (req) {
const verifiedPayload = await jwt.verify(idToken, applePublicKey, { algorithms: 'RS256' });
let { email } = verifiedPayload;
if ((!email || email === '') && req.body.email) {
email = req.body.email;
}
return {
id: verifiedPayload.sub,
emails: [{ value: verifiedPayload.email }],
emails: [{ value: email }],
name: verifiedPayload.name || req.body.name || req.query.name,
idToken,
};