mirror of
				https://codeberg.org/yeentown/barkey.git
				synced 2025-11-04 15:34:13 +00:00 
			
		
		
		
	upd: handle email signups properly with approval enabled
This commit is contained in:
		
							parent
							
								
									3f0cc256dc
								
							
						
					
					
						commit
						32fc540df4
					
				
					 3 changed files with 15 additions and 4 deletions
				
			
		| 
						 | 
					@ -279,8 +279,12 @@ export class SignupApiService {
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (instance.approvalRequiredForSignup) {
 | 
								if (instance.approvalRequiredForSignup) {
 | 
				
			||||||
				reply.code(204);
 | 
									if (pendingUser.email) {
 | 
				
			||||||
				return;
 | 
										this.emailService.sendEmail(pendingUser.email, 'Approval pending',
 | 
				
			||||||
 | 
											'Congratulations! Your account is now pending approval. You will get notified when you have been accepted.',
 | 
				
			||||||
 | 
											'Congratulations! Your account is now pending approval. You will get notified when you have been accepted.');
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									return { pendingApproval: true };
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			return this.signinService.signin(request, reply, account as MiLocalUser);
 | 
								return this.signinService.signin(request, reply, account as MiLocalUser);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -182,7 +182,7 @@ SPDX-License-Identifier: AGPL-3.0-only
 | 
				
			||||||
			<div v-else-if="tab === 'approval'" class="_gaps_m">
 | 
								<div v-else-if="tab === 'approval'" class="_gaps_m">
 | 
				
			||||||
				<MkKeyValue oneline>
 | 
									<MkKeyValue oneline>
 | 
				
			||||||
					<template #key>{{ i18n.ts.approvalStatus }}</template>
 | 
										<template #key>{{ i18n.ts.approvalStatus }}</template>
 | 
				
			||||||
					<template #value><span class="_monospace">{{ approved ? {{ i18n.ts.approved }} : {{ i18n.ts.notApproved }} }}</span></template>
 | 
										<template #value><span class="_monospace">{{ approved ? i18n.ts.approved : i18n.ts.notApproved }}</span></template>
 | 
				
			||||||
				</MkKeyValue>
 | 
									</MkKeyValue>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				<MkTextarea v-model="signupReason" readonly>
 | 
									<MkTextarea v-model="signupReason" readonly>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -45,6 +45,13 @@ function submit() {
 | 
				
			||||||
	os.api('signup-pending', {
 | 
						os.api('signup-pending', {
 | 
				
			||||||
		code: props.code,
 | 
							code: props.code,
 | 
				
			||||||
	}).then(res => {
 | 
						}).then(res => {
 | 
				
			||||||
 | 
							if (res.pendingApproval) {
 | 
				
			||||||
 | 
								return os.alert({
 | 
				
			||||||
 | 
									type: 'success',
 | 
				
			||||||
 | 
									title: i18n.ts._signup.almostThere,
 | 
				
			||||||
 | 
									text: i18n.ts._signup.approvalPending,
 | 
				
			||||||
 | 
								});
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		return login(res.i, '/');
 | 
							return login(res.i, '/');
 | 
				
			||||||
	}).catch(() => {
 | 
						}).catch(() => {
 | 
				
			||||||
		submitting = false;
 | 
							submitting = false;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue