register static method
Creates a new user Returns Status.status 201 = complete; 400 = wrong inputs + Status.error; 500 = server error;
When creating a producer account use orgName
(former requested_org) to name the Producer or brand
Implementation
static Future<SignUpStatus> register({
required User user,
required String name,
required String email,
String? orgName,
bool newsletter = true,
QueryType? queryType,
}) async {
if (name.length > USER_NAME_MAX_LENGTH) {
throw ArgumentError(
'A username may not exceed $USER_NAME_MAX_LENGTH characters!',
);
}
var registerUri = UriHelper.getUri(
path: '/cgi/user.pl',
queryType: queryType,
addUserAgentParameters: false,
);
Map<String, String> data = <String, String>{
'name': name,
'email': email,
'userid': user.userId,
'password': user.password,
'confirm_password': user.password,
if (orgName != null) 'pro': 'on',
'pro_checkbox': '1',
'requested_org': orgName ?? ' ',
if (newsletter) 'newsletter': 'on',
'action': 'process',
'type': 'add',
'.submit': 'Register',
};
Status status = await HttpHelper().doMultipartRequest(
registerUri,
data,
queryType: queryType,
);
return SignUpStatus(status);
}