You've already forked matrix-react-sdk
							
							
				mirror of
				https://github.com/matrix-org/matrix-react-sdk.git
				synced 2025-11-04 11:51:45 +03:00 
			
		
		
		
	Simplify registration with email validation (#11398)
This commit is contained in:
		
				
					committed by
					
						
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							beafe686a9
						
					
				
				
					commit
					0842559fb2
				
			@@ -65,6 +65,12 @@ async function cfgDirFromTemplate(opts: StartHomeserverOpts): Promise<Homeserver
 | 
			
		||||
    hsYaml = hsYaml.replace(/{{FORM_SECRET}}/g, formSecret);
 | 
			
		||||
    hsYaml = hsYaml.replace(/{{PUBLIC_BASEURL}}/g, baseUrl);
 | 
			
		||||
    hsYaml = hsYaml.replace(/{{OAUTH_SERVER_PORT}}/g, opts.oAuthServerPort?.toString());
 | 
			
		||||
    if (opts.variables) {
 | 
			
		||||
        for (const key in opts.variables) {
 | 
			
		||||
            hsYaml = hsYaml.replace(new RegExp("%" + key + "%", "g"), String(opts.variables[key]));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    await fse.writeFile(path.join(tempDir, "homeserver.yaml"), hsYaml);
 | 
			
		||||
 | 
			
		||||
    // now generate a signing key (we could use synapse's config generation for
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										1
									
								
								cypress/plugins/synapsedocker/templates/email/README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								cypress/plugins/synapsedocker/templates/email/README.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
A synapse configured to require an email for registration
 | 
			
		||||
@@ -0,0 +1,44 @@
 | 
			
		||||
server_name: "localhost"
 | 
			
		||||
pid_file: /data/homeserver.pid
 | 
			
		||||
public_baseurl: "{{PUBLIC_BASEURL}}"
 | 
			
		||||
listeners:
 | 
			
		||||
    - port: 8008
 | 
			
		||||
      tls: false
 | 
			
		||||
      bind_addresses: ["::"]
 | 
			
		||||
      type: http
 | 
			
		||||
      x_forwarded: true
 | 
			
		||||
 | 
			
		||||
      resources:
 | 
			
		||||
          - names: [client]
 | 
			
		||||
            compress: false
 | 
			
		||||
 | 
			
		||||
database:
 | 
			
		||||
    name: "sqlite3"
 | 
			
		||||
    args:
 | 
			
		||||
        database: ":memory:"
 | 
			
		||||
 | 
			
		||||
log_config: "/data/log.config"
 | 
			
		||||
 | 
			
		||||
media_store_path: "/data/media_store"
 | 
			
		||||
uploads_path: "/data/uploads"
 | 
			
		||||
enable_registration: true
 | 
			
		||||
registrations_require_3pid:
 | 
			
		||||
    - email
 | 
			
		||||
registration_shared_secret: "{{REGISTRATION_SECRET}}"
 | 
			
		||||
report_stats: false
 | 
			
		||||
macaroon_secret_key: "{{MACAROON_SECRET_KEY}}"
 | 
			
		||||
form_secret: "{{FORM_SECRET}}"
 | 
			
		||||
signing_key_path: "/data/localhost.signing.key"
 | 
			
		||||
 | 
			
		||||
trusted_key_servers:
 | 
			
		||||
    - server_name: "matrix.org"
 | 
			
		||||
suppress_key_server_warning: true
 | 
			
		||||
 | 
			
		||||
ui_auth:
 | 
			
		||||
    session_timeout: "300s"
 | 
			
		||||
 | 
			
		||||
email:
 | 
			
		||||
    smtp_host: "%SMTP_HOST%"
 | 
			
		||||
    smtp_port: %SMTP_PORT%
 | 
			
		||||
    notif_from: "Your Friendly %(app)s homeserver <noreply@example.com>"
 | 
			
		||||
    app_name: my_branded_matrix_server
 | 
			
		||||
							
								
								
									
										50
									
								
								cypress/plugins/synapsedocker/templates/email/log.config
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								cypress/plugins/synapsedocker/templates/email/log.config
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,50 @@
 | 
			
		||||
# Log configuration for Synapse.
 | 
			
		||||
#
 | 
			
		||||
# This is a YAML file containing a standard Python logging configuration
 | 
			
		||||
# dictionary. See [1] for details on the valid settings.
 | 
			
		||||
#
 | 
			
		||||
# Synapse also supports structured logging for machine readable logs which can
 | 
			
		||||
# be ingested by ELK stacks. See [2] for details.
 | 
			
		||||
#
 | 
			
		||||
# [1]: https://docs.python.org/3.7/library/logging.config.html#configuration-dictionary-schema
 | 
			
		||||
# [2]: https://matrix-org.github.io/synapse/latest/structured_logging.html
 | 
			
		||||
 | 
			
		||||
version: 1
 | 
			
		||||
 | 
			
		||||
formatters:
 | 
			
		||||
    precise:
 | 
			
		||||
        format: '%(asctime)s - %(name)s - %(lineno)d - %(levelname)s - %(request)s - %(message)s'
 | 
			
		||||
 | 
			
		||||
handlers:
 | 
			
		||||
    # A handler that writes logs to stderr. Unused by default, but can be used
 | 
			
		||||
    # instead of "buffer" and "file" in the logger handlers.
 | 
			
		||||
    console:
 | 
			
		||||
        class: logging.StreamHandler
 | 
			
		||||
        formatter: precise
 | 
			
		||||
 | 
			
		||||
loggers:
 | 
			
		||||
    synapse.storage.SQL:
 | 
			
		||||
        # beware: increasing this to DEBUG will make synapse log sensitive
 | 
			
		||||
        # information such as access tokens.
 | 
			
		||||
        level: INFO
 | 
			
		||||
 | 
			
		||||
    twisted:
 | 
			
		||||
        # We send the twisted logging directly to the file handler,
 | 
			
		||||
        # to work around https://github.com/matrix-org/synapse/issues/3471
 | 
			
		||||
        # when using "buffer" logger. Use "console" to log to stderr instead.
 | 
			
		||||
        handlers: [console]
 | 
			
		||||
        propagate: false
 | 
			
		||||
 | 
			
		||||
root:
 | 
			
		||||
    level: INFO
 | 
			
		||||
 | 
			
		||||
    # Write logs to the `buffer` handler, which will buffer them together in memory,
 | 
			
		||||
    # then write them to a file.
 | 
			
		||||
    #
 | 
			
		||||
    # Replace "buffer" with "console" to log to stderr instead. (Note that you'll
 | 
			
		||||
    # also need to update the configuration for the `twisted` logger above, in
 | 
			
		||||
    # this case.)
 | 
			
		||||
    #
 | 
			
		||||
    handlers: [console]
 | 
			
		||||
 | 
			
		||||
disable_existing_loggers: false
 | 
			
		||||
		Reference in New Issue
	
	Block a user