mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-31 00:22:26 -05:00 
			
		
		
		
	[feature] New user sign-up via web page (#2796)
* [feature] User sign-up form and admin notifs * add chosen + filtered languages to migration * remove stray comment * chosen languages schmosen schmanguages * proper error on local account missing
This commit is contained in:
		
					parent
					
						
							
								a483bd9e38
							
						
					
				
			
			
				commit
				
					
						9fb8a78f91
					
				
			
		
					 68 changed files with 1456 additions and 437 deletions
				
			
		|  | @ -348,3 +348,42 @@ func FilterContexts(contexts []apimodel.FilterContext) error { | |||
| 	} | ||||
| 	return nil | ||||
| } | ||||
| 
 | ||||
| // CreateAccount checks through all the prerequisites for | ||||
| // creating a new account, according to the provided form. | ||||
| // If the account isn't eligible, an error will be returned. | ||||
| // | ||||
| // Side effect: normalizes the provided language tag for the user's locale. | ||||
| func CreateAccount(form *apimodel.AccountCreateRequest) error { | ||||
| 	if form == nil { | ||||
| 		return errors.New("form was nil") | ||||
| 	} | ||||
| 
 | ||||
| 	if !config.GetAccountsRegistrationOpen() { | ||||
| 		return errors.New("registration is not open for this server") | ||||
| 	} | ||||
| 
 | ||||
| 	if err := Username(form.Username); err != nil { | ||||
| 		return err | ||||
| 	} | ||||
| 
 | ||||
| 	if err := Email(form.Email); err != nil { | ||||
| 		return err | ||||
| 	} | ||||
| 
 | ||||
| 	if err := Password(form.Password); err != nil { | ||||
| 		return err | ||||
| 	} | ||||
| 
 | ||||
| 	if !form.Agreement { | ||||
| 		return errors.New("agreement to terms and conditions not given") | ||||
| 	} | ||||
| 
 | ||||
| 	locale, err := Language(form.Locale) | ||||
| 	if err != nil { | ||||
| 		return err | ||||
| 	} | ||||
| 	form.Locale = locale | ||||
| 
 | ||||
| 	return SignUpReason(form.Reason, config.GetAccountsReasonRequired()) | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue