fix(backend): 登録にメール認証が必須になっている場合、登録されているメールアドレスを削除できないように (#13703)
* fix(backend): 登録にメール認証が必須になっている場合、登録されているメールアドレスを削除できないように (MisskeyIO#606) (cherry picked from commit 6b7df2bd10dc28b84f525a621b66fc49bf59cac6) * Update Changelog --------- Co-authored-by: まっちゃとーにゅ <17376330+u1-liquid@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									f5100cc81f
								
							
						
					
					
						commit
						5c7c44c9eb
					
				
					 2 changed files with 12 additions and 0 deletions
				
			
		| 
						 | 
					@ -48,6 +48,8 @@
 | 
				
			||||||
- Fix: エンドポイント`notes/translate`のエラーを改善
 | 
					- Fix: エンドポイント`notes/translate`のエラーを改善
 | 
				
			||||||
- Fix: CleanRemoteFilesProcessorService report progress from 100% (#13632)
 | 
					- Fix: CleanRemoteFilesProcessorService report progress from 100% (#13632)
 | 
				
			||||||
- Fix: 一部の音声ファイルが映像ファイルとして扱われる問題を修正
 | 
					- Fix: 一部の音声ファイルが映像ファイルとして扱われる問題を修正
 | 
				
			||||||
 | 
					- Fix: 登録にメール認証が必須になっている場合、登録されているメールアドレスを削除できないように  
 | 
				
			||||||
 | 
					  (Cherry-picked from https://github.com/MisskeyIO/misskey/pull/606)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## 2024.3.1
 | 
					## 2024.3.1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -15,6 +15,7 @@ import { DI } from '@/di-symbols.js';
 | 
				
			||||||
import { GlobalEventService } from '@/core/GlobalEventService.js';
 | 
					import { GlobalEventService } from '@/core/GlobalEventService.js';
 | 
				
			||||||
import { L_CHARS, secureRndstr } from '@/misc/secure-rndstr.js';
 | 
					import { L_CHARS, secureRndstr } from '@/misc/secure-rndstr.js';
 | 
				
			||||||
import { UserAuthService } from '@/core/UserAuthService.js';
 | 
					import { UserAuthService } from '@/core/UserAuthService.js';
 | 
				
			||||||
 | 
					import { MetaService } from '@/core/MetaService.js';
 | 
				
			||||||
import { ApiError } from '../../error.js';
 | 
					import { ApiError } from '../../error.js';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const meta = {
 | 
					export const meta = {
 | 
				
			||||||
| 
						 | 
					@ -39,6 +40,12 @@ export const meta = {
 | 
				
			||||||
			code: 'UNAVAILABLE',
 | 
								code: 'UNAVAILABLE',
 | 
				
			||||||
			id: 'a2defefb-f220-8849-0af6-17f816099323',
 | 
								id: 'a2defefb-f220-8849-0af6-17f816099323',
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							emailRequired: {
 | 
				
			||||||
 | 
								message: 'Email address is required.',
 | 
				
			||||||
 | 
								code: 'EMAIL_REQUIRED',
 | 
				
			||||||
 | 
								id: '324c7a88-59f2-492f-903f-89134f93e47e',
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	res: {
 | 
						res: {
 | 
				
			||||||
| 
						 | 
					@ -66,6 +73,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
 | 
				
			||||||
		@Inject(DI.userProfilesRepository)
 | 
							@Inject(DI.userProfilesRepository)
 | 
				
			||||||
		private userProfilesRepository: UserProfilesRepository,
 | 
							private userProfilesRepository: UserProfilesRepository,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							private metaService: MetaService,
 | 
				
			||||||
		private userEntityService: UserEntityService,
 | 
							private userEntityService: UserEntityService,
 | 
				
			||||||
		private emailService: EmailService,
 | 
							private emailService: EmailService,
 | 
				
			||||||
		private userAuthService: UserAuthService,
 | 
							private userAuthService: UserAuthService,
 | 
				
			||||||
| 
						 | 
					@ -97,6 +105,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
 | 
				
			||||||
				if (!res.available) {
 | 
									if (!res.available) {
 | 
				
			||||||
					throw new ApiError(meta.errors.unavailable);
 | 
										throw new ApiError(meta.errors.unavailable);
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
								} else if ((await this.metaService.fetch()).emailRequiredForSignup) {
 | 
				
			||||||
 | 
									throw new ApiError(meta.errors.emailRequired);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			await this.userProfilesRepository.update(me.id, {
 | 
								await this.userProfilesRepository.update(me.id, {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue