@@ -26,10 +26,10 @@ class AuthenticationView : Subview
26
26
[ SerializeField ] private string username = string . Empty ;
27
27
[ SerializeField ] private string two2fa = string . Empty ;
28
28
[ SerializeField ] private string message ;
29
+ [ SerializeField ] private string errorMessage ;
30
+ [ SerializeField ] private bool need2fa ;
29
31
30
- [ NonSerialized ] private bool need2fa ;
31
32
[ NonSerialized ] private bool isBusy ;
32
- [ NonSerialized ] private string errorMessage ;
33
33
[ NonSerialized ] private bool enterPressed ;
34
34
[ NonSerialized ] private string password = string . Empty ;
35
35
[ NonSerialized ] private AuthenticationService authenticationService ;
@@ -39,6 +39,7 @@ public override void InitializeView(IView parent)
39
39
{
40
40
base . InitializeView ( parent ) ;
41
41
need2fa = isBusy = false ;
42
+ message = errorMessage = null ;
42
43
Title = WindowTitle ;
43
44
Size = viewSize ;
44
45
}
@@ -167,8 +168,7 @@ private void OnGUI2FA()
167
168
if ( GUILayout . Button ( BackButton ) )
168
169
{
169
170
GUI . FocusControl ( null ) ;
170
- need2fa = false ;
171
- Redraw ( ) ;
171
+ Clear ( ) ;
172
172
}
173
173
174
174
if ( GUILayout . Button ( TwofaButton ) || ( ! isBusy && enterPressed ) )
@@ -189,27 +189,36 @@ private void OnGUI2FA()
189
189
190
190
private void DoRequire2fa ( string msg )
191
191
{
192
- Logger . Trace ( "Strating 2FA - Message:\" {0}\" " , msg ) ;
192
+ Logger . Trace ( "Starting 2FA - Message:\" {0}\" " , msg ) ;
193
193
194
194
need2fa = true ;
195
195
errorMessage = msg ;
196
196
isBusy = false ;
197
197
Redraw ( ) ;
198
198
}
199
199
200
+ private void Clear ( )
201
+ {
202
+ need2fa = false ;
203
+ errorMessage = null ;
204
+ isBusy = false ;
205
+ Redraw ( ) ;
206
+ }
207
+
200
208
private void DoResult ( bool success , string msg )
201
209
{
202
210
Logger . Trace ( "DoResult - Success:{0} Message:\" {1}\" " , success , msg ) ;
203
211
204
- errorMessage = msg ;
205
212
isBusy = false ;
206
213
207
214
if ( success == true )
208
215
{
216
+ Clear ( ) ;
209
217
Finish ( true ) ;
210
218
}
211
219
else
212
220
{
221
+ errorMessage = msg ;
213
222
Redraw ( ) ;
214
223
}
215
224
}
0 commit comments