@@ -26,10 +26,10 @@ class AuthenticationView : Subview
2626 [ SerializeField ] private string username = string . Empty ;
2727 [ SerializeField ] private string two2fa = string . Empty ;
2828 [ SerializeField ] private string message ;
29+ [ SerializeField ] private string errorMessage ;
30+ [ SerializeField ] private bool need2fa ;
2931
30- [ NonSerialized ] private bool need2fa ;
3132 [ NonSerialized ] private bool isBusy ;
32- [ NonSerialized ] private string errorMessage ;
3333 [ NonSerialized ] private bool enterPressed ;
3434 [ NonSerialized ] private string password = string . Empty ;
3535 [ NonSerialized ] private AuthenticationService authenticationService ;
@@ -39,6 +39,7 @@ public override void InitializeView(IView parent)
3939 {
4040 base . InitializeView ( parent ) ;
4141 need2fa = isBusy = false ;
42+ message = errorMessage = null ;
4243 Title = WindowTitle ;
4344 Size = viewSize ;
4445 }
@@ -167,8 +168,7 @@ private void OnGUI2FA()
167168 if ( GUILayout . Button ( BackButton ) )
168169 {
169170 GUI . FocusControl ( null ) ;
170- need2fa = false ;
171- Redraw ( ) ;
171+ Clear ( ) ;
172172 }
173173
174174 if ( GUILayout . Button ( TwofaButton ) || ( ! isBusy && enterPressed ) )
@@ -189,27 +189,36 @@ private void OnGUI2FA()
189189
190190 private void DoRequire2fa ( string msg )
191191 {
192- Logger . Trace ( "Strating 2FA - Message:\" {0}\" " , msg ) ;
192+ Logger . Trace ( "Starting 2FA - Message:\" {0}\" " , msg ) ;
193193
194194 need2fa = true ;
195195 errorMessage = msg ;
196196 isBusy = false ;
197197 Redraw ( ) ;
198198 }
199199
200+ private void Clear ( )
201+ {
202+ need2fa = false ;
203+ errorMessage = null ;
204+ isBusy = false ;
205+ Redraw ( ) ;
206+ }
207+
200208 private void DoResult ( bool success , string msg )
201209 {
202210 Logger . Trace ( "DoResult - Success:{0} Message:\" {1}\" " , success , msg ) ;
203211
204- errorMessage = msg ;
205212 isBusy = false ;
206213
207214 if ( success == true )
208215 {
216+ Clear ( ) ;
209217 Finish ( true ) ;
210218 }
211219 else
212220 {
221+ errorMessage = msg ;
213222 Redraw ( ) ;
214223 }
215224 }
0 commit comments