@@ -71,8 +71,6 @@ import org.openedx.core.ui.HorizontalLine
7171import org.openedx.core.ui.HyperlinkText
7272import org.openedx.core.ui.OpenEdXButton
7373import org.openedx.core.ui.OpenEdXOutlinedButton
74- import org.openedx.core.ui.WindowSize
75- import org.openedx.core.ui.WindowType
7674import org.openedx.core.ui.displayCutoutForLandscape
7775import org.openedx.core.ui.noRippleClickable
7876import org.openedx.core.ui.theme.OpenEdXTheme
@@ -235,109 +233,109 @@ private fun AuthForm(
235233 var isPasswordError by rememberSaveable { mutableStateOf(false ) }
236234
237235 if (state.isLoginRegistrationFormEnabled) {
238- Column (horizontalAlignment = Alignment .CenterHorizontally ) {
239- if (! state.isBrowserLoginEnabled) {
240- LoginTextField (
241- modifier = Modifier
242- .fillMaxWidth(),
243- title = stringResource(id = R .string.auth_email_username),
244- description = stringResource(id = R .string.auth_enter_email_username),
245- onValueChanged = {
246- login = it
247- isEmailError = false
248- },
249- isError = isEmailError,
250- errorMessages = stringResource(id = R .string.auth_error_empty_username_email)
251- )
236+ Column (horizontalAlignment = Alignment .CenterHorizontally ) {
237+ if (! state.isBrowserLoginEnabled) {
238+ LoginTextField (
239+ modifier = Modifier
240+ .fillMaxWidth(),
241+ title = stringResource(id = R .string.auth_email_username),
242+ description = stringResource(id = R .string.auth_enter_email_username),
243+ onValueChanged = {
244+ login = it
245+ isEmailError = false
246+ },
247+ isError = isEmailError,
248+ errorMessages = stringResource(id = R .string.auth_error_empty_username_email)
249+ )
252250
253- Spacer (modifier = Modifier .height(18 .dp))
254- PasswordTextField (
255- modifier = Modifier
256- .fillMaxWidth(),
257- onValueChanged = {
258- password = it
259- isPasswordError = false
260- },
261- onPressDone = {
262- keyboardController?.hide()
263- if (password.isNotEmpty()) {
264- onEvent(AuthEvent .SignIn (login = login, password = password))
265- } else {
266- isEmailError = login.isEmpty()
267- isPasswordError = password.isEmpty()
268- }
269- },
270- isError = isPasswordError,
271- )
272- } else {
273- Spacer (modifier = Modifier .height(40 .dp))
274- }
251+ Spacer (modifier = Modifier .height(18 .dp))
252+ PasswordTextField (
253+ modifier = Modifier
254+ .fillMaxWidth(),
255+ onValueChanged = {
256+ password = it
257+ isPasswordError = false
258+ },
259+ onPressDone = {
260+ keyboardController?.hide()
261+ if (password.isNotEmpty()) {
262+ onEvent(AuthEvent .SignIn (login = login, password = password))
263+ } else {
264+ isEmailError = login.isEmpty()
265+ isPasswordError = password.isEmpty()
266+ }
267+ },
268+ isError = isPasswordError,
269+ )
270+ } else {
271+ Spacer (modifier = Modifier .height(40 .dp))
272+ }
275273
276- Row (
277- Modifier
278- .fillMaxWidth()
279- .padding(top = 20 .dp, bottom = 36 .dp)
280- ) {
281- if (state.isLogistrationEnabled.not ()) {
282- if (! state.isBrowserLoginEnabled) {
283- if (state.isLogistrationEnabled.not () && state.isRegistrationEnabled) {
274+ Row (
275+ Modifier
276+ .fillMaxWidth()
277+ .padding(top = 20 .dp, bottom = 36 .dp)
278+ ) {
279+ if (state.isLogistrationEnabled.not ()) {
280+ if (! state.isBrowserLoginEnabled) {
281+ if (state.isLogistrationEnabled.not () && state.isRegistrationEnabled) {
282+ Text (
283+ modifier = Modifier
284+ .testTag(" txt_register" )
285+ .noRippleClickable {
286+ onEvent(AuthEvent .RegisterClick )
287+ },
288+ text = stringResource(id = coreR.string.core_register),
289+ color = MaterialTheme .appColors.primary,
290+ style = MaterialTheme .appTypography.labelLarge
291+ )
292+ }
293+ Spacer (modifier = Modifier .weight(1f ))
284294 Text (
285295 modifier = Modifier
286- .testTag(" txt_register " )
296+ .testTag(" txt_forgot_password " )
287297 .noRippleClickable {
288- onEvent(AuthEvent .RegisterClick )
298+ onEvent(AuthEvent .ForgotPasswordClick )
289299 },
290- text = stringResource(id = coreR .string.core_register ),
291- color = MaterialTheme .appColors.primary ,
300+ text = stringResource(id = R .string.auth_forgot_password ),
301+ color = MaterialTheme .appColors.infoVariant ,
292302 style = MaterialTheme .appTypography.labelLarge
293303 )
294304 }
295- Spacer (modifier = Modifier .weight(1f ))
296- Text (
297- modifier = Modifier
298- .testTag(" txt_forgot_password" )
299- .noRippleClickable {
300- onEvent(AuthEvent .ForgotPasswordClick )
301- },
302- text = stringResource(id = R .string.auth_forgot_password),
303- color = MaterialTheme .appColors.infoVariant,
304- style = MaterialTheme .appTypography.labelLarge
305- )
306305 }
307306 }
308- }
309307
310308
311- if (state.showProgress) {
312- CircularProgressIndicator (color = MaterialTheme .appColors.primary)
313- } else {
314- OpenEdXButton (
315- modifier = buttonWidth.testTag(" btn_sign_in" ),
316- text = stringResource(id = coreR.string.core_sign_in),
317- textColor = MaterialTheme .appColors.primaryButtonText,
318- backgroundColor = MaterialTheme .appColors.secondaryButtonBackground,
319- onClick = {
320- if (state.isBrowserLoginEnabled) {
321- onEvent(AuthEvent .SignInBrowser )
322- } else {
323- keyboardController?.hide()
324- if (login.isNotEmpty() && password.isNotEmpty()) {
325- onEvent(AuthEvent .SignIn (login = login, password = password))
309+ if (state.showProgress) {
310+ CircularProgressIndicator (color = MaterialTheme .appColors.primary)
311+ } else {
312+ OpenEdXButton (
313+ modifier = buttonWidth.testTag(" btn_sign_in" ),
314+ text = stringResource(id = coreR.string.core_sign_in),
315+ textColor = MaterialTheme .appColors.primaryButtonText,
316+ backgroundColor = MaterialTheme .appColors.secondaryButtonBackground,
317+ onClick = {
318+ if (state.isBrowserLoginEnabled) {
319+ onEvent(AuthEvent .SignInBrowser )
326320 } else {
327- isEmailError = login.isEmpty()
328- isPasswordError = password.isEmpty()
321+ keyboardController?.hide()
322+ if (login.isNotEmpty() && password.isNotEmpty()) {
323+ onEvent(AuthEvent .SignIn (login = login, password = password))
324+ } else {
325+ isEmailError = login.isEmpty()
326+ isPasswordError = password.isEmpty()
327+ }
329328 }
330329 }
331- }
332- )
333- }
334- if (state.isSocialAuthEnabled) {
335- SocialAuthView (
336- modifier = buttonWidth,
337- isGoogleAuthEnabled = state.isGoogleAuthEnabled,
338- isFacebookAuthEnabled = state.isFacebookAuthEnabled,
339- isMicrosoftAuthEnabled = state.isMicrosoftAuthEnabled,
340- isSignIn = true ,
330+ )
331+ }
332+ if (state.isSocialAuthEnabled) {
333+ SocialAuthView (
334+ modifier = buttonWidth,
335+ isGoogleAuthEnabled = state.isGoogleAuthEnabled,
336+ isFacebookAuthEnabled = state.isFacebookAuthEnabled,
337+ isMicrosoftAuthEnabled = state.isMicrosoftAuthEnabled,
338+ isSignIn = true ,
341339 ) {
342340 keyboardController?.hide()
343341 onEvent(AuthEvent .SocialSignIn (it))
0 commit comments