usersPasswordValidations function
Implementation
Future<Map<String, dynamic>> usersPasswordValidations(
dynamic data,
Map<String, dynamic> editorConfig,
String action,
Map<String, dynamic> params,
BuildContext? context,
) async {
Map<String, dynamic> result = genericFuncArrayDefaultValue(data);
switch (action) {
case actionCreate:
if (data['passcode'].isEmpty) {
result['error'] = 'User needs a password';
}
break;
case actionUpdate:
if (data['passcode'].isNotEmpty) {
if (data['passcode'] != data['passcode_repeat']) {
result['error'] =
'"New Password" and "Repeat New Password" must be same';
}
}
break;
default:
break;
}
return result;
}