File tree Expand file tree Collapse file tree 5 files changed +12
-6
lines changed
clerk_flutter/lib/src/widgets Expand file tree Collapse file tree 5 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -438,7 +438,7 @@ class Auth {
438438
439439 case SignIn signIn
440440 when signIn.status.needsFactor &&
441- strategy == Strategy .password &&
441+ strategy.isPassword &&
442442 password is String :
443443 await _api
444444 .attemptSignIn (
Original file line number Diff line number Diff line change @@ -112,6 +112,9 @@ class SignIn with InformativeToStringMixin {
112112 _ => const [],
113113 };
114114
115+ /// can we handle the password strategy?
116+ bool get canUsePassword => factors.any ((f) => f.strategy.isPassword);
117+
115118 /// Find the [Factor] for this [SignIn] that matches
116119 /// the [strategy] and [stage]
117120 ///
Original file line number Diff line number Diff line change @@ -157,6 +157,9 @@ class Strategy {
157157 /// is known?
158158 bool get isKnown => isUnknown == false ;
159159
160+ /// is password?
161+ bool get isPassword => this == password;
162+
160163 /// is some variety of oauth?
161164 bool get isOauth => name == _oauth || isOauthCustom || isOauthToken;
162165
Original file line number Diff line number Diff line change @@ -108,7 +108,8 @@ class _ClerkSignInPanelState extends State<ClerkSignInPanel>
108108 bool _requiresBack (clerk.SignIn signIn) => signIn.status.isUnknown == false ;
109109
110110 bool _requiresContinue (clerk.SignIn signIn) =>
111- _strategy.isUnknown || _strategy.requiresPassword;
111+ signIn.status.isUnknown ||
112+ (signIn.verification == null && signIn.canUsePassword);
112113
113114 @override
114115 Widget build (BuildContext context) {
@@ -280,8 +281,7 @@ class _FactorList extends StatelessWidget {
280281 @override
281282 Widget build (BuildContext context) {
282283 final l10ns = ClerkAuth .localizationsOf (context);
283- final hasPassword =
284- factors.any ((f) => f.strategy == clerk.Strategy .password);
284+ final hasPassword = factors.any ((f) => f.strategy.isPassword);
285285 final otherFactors = factors.where (StrategyButton .supports).toList ();
286286
287287 return Column (
Original file line number Diff line number Diff line change @@ -49,8 +49,8 @@ class InputLabel extends StatelessWidget {
4949 localizations.requiredField,
5050 color: ClerkColors .incarnadine,
5151 )
52- else if (isOptional == false ) //
53- _LabelModifier (localizations.requiredField ),
52+ else if (isOptional == true ) //
53+ _LabelModifier (localizations.optional ),
5454 if (trailing case Widget trailing) //
5555 trailing,
5656 ],
You can’t perform that action at this time.
0 commit comments