forked from baron/baron-sso
feat(auth): lock affiliation type on frontend based on verified email domain (#500)
This commit is contained in:
@@ -923,13 +923,19 @@ class AuthProxyService {
|
||||
}
|
||||
}
|
||||
|
||||
static Future<List<Map<String, dynamic>>> getActiveTenants() async {
|
||||
final url = Uri.parse('$_baseUrl/api/v1/auth/signup/tenants');
|
||||
final response = await http.get(url);
|
||||
static Future<List<Map<String, dynamic>>> getActiveTenants({
|
||||
String? email,
|
||||
}) async {
|
||||
var uriString = '$_baseUrl/api/v1/auth/signup/tenants';
|
||||
if (email != null && email.isNotEmpty) {
|
||||
uriString += '?email=${Uri.encodeComponent(email)}';
|
||||
}
|
||||
|
||||
final url = Uri.parse(uriString);
|
||||
final response = await http.get(url);
|
||||
if (response.statusCode == 200) {
|
||||
final List<dynamic> data = jsonDecode(response.body);
|
||||
return data.cast<Map<String, dynamic>>();
|
||||
final List<dynamic> list = jsonDecode(response.body);
|
||||
return list.cast<Map<String, dynamic>>();
|
||||
}
|
||||
return [];
|
||||
}
|
||||
@@ -953,7 +959,7 @@ class AuthProxyService {
|
||||
}
|
||||
}
|
||||
|
||||
static Future<bool> verifySignupCode(
|
||||
static Future<Map<String, dynamic>> verifySignupCode(
|
||||
String target,
|
||||
String type,
|
||||
String code,
|
||||
@@ -967,10 +973,9 @@ class AuthProxyService {
|
||||
);
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
final data = jsonDecode(response.body);
|
||||
return data['success'] ?? false;
|
||||
return jsonDecode(response.body);
|
||||
}
|
||||
return false;
|
||||
throw Exception('Verification failed');
|
||||
}
|
||||
|
||||
static Future<void> signup({
|
||||
|
||||
Reference in New Issue
Block a user