Fixed "failureRedirect" test case
This commit is contained in:
parent
a30201ebb1
commit
05a45bee4f
2 changed files with 4 additions and 3 deletions
|
@ -8,7 +8,7 @@ bool _validateString(String? str) => str != null && str.isNotEmpty;
|
|||
|
||||
/// Determines the validity of an incoming username and password.
|
||||
// typedef FutureOr<User> LocalAuthVerifier<User>(String? username, String? password);
|
||||
typedef LocalAuthVerifier<User> = FutureOr<User> Function(
|
||||
typedef LocalAuthVerifier<User> = FutureOr<User?> Function(
|
||||
String? username, String? password);
|
||||
|
||||
class LocalAuthStrategy<User> extends AuthStrategy<User> {
|
||||
|
|
|
@ -13,11 +13,12 @@ var localOpts = AngelAuthOptions<Map<String, String>>(
|
|||
failureRedirect: '/failure', successRedirect: '/success');
|
||||
Map<String, String> sampleUser = {'hello': 'world'};
|
||||
|
||||
Future<Map<String, String>> verifier(String? username, String? password) async {
|
||||
Future<Map<String, String>?> verifier(
|
||||
String? username, String? password) async {
|
||||
if (username == 'username' && password == 'password') {
|
||||
return sampleUser;
|
||||
} else {
|
||||
throw ArgumentError('Unexpected type for data');
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue