Not to create an account if already exist (#11366)
This commit is contained in:
		
							parent
							
								
									c37c1da41e
								
							
						
					
					
						commit
						2859790890
					
				
					 1 changed files with 2 additions and 1 deletions
				
			
		| 
						 | 
					@ -1,7 +1,8 @@
 | 
				
			||||||
Doorkeeper::Application.create!(name: 'Web', superapp: true, redirect_uri: Doorkeeper.configuration.native_redirect_uri, scopes: 'read write follow')
 | 
					Doorkeeper::Application.create!(name: 'Web', superapp: true, redirect_uri: Doorkeeper.configuration.native_redirect_uri, scopes: 'read write follow')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
domain = ENV['LOCAL_DOMAIN'] || Rails.configuration.x.local_domain
 | 
					domain = ENV['LOCAL_DOMAIN'] || Rails.configuration.x.local_domain
 | 
				
			||||||
Account.create!(id: -99, actor_type: 'Application', locked: true, username: domain)
 | 
					account = Account.find_or_initialize_by(id: -99, actor_type: 'Application', locked: true, username: domain)
 | 
				
			||||||
 | 
					account.save!
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if Rails.env.development?
 | 
					if Rails.env.development?
 | 
				
			||||||
  admin  = Account.where(username: 'admin').first_or_initialize(username: 'admin')
 | 
					  admin  = Account.where(username: 'admin').first_or_initialize(username: 'admin')
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue