Skip to content

Commit

Permalink
Improved security of password Textfields
Browse files Browse the repository at this point in the history
  • Loading branch information
itsPronay authored and therajanmaurya committed Mar 23, 2024
1 parent 1dda11b commit 319dd87
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
4 changes: 3 additions & 1 deletion app/src/main/java/org/mifos/mobile/ui/login/LoginScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.text.input.PasswordVisualTransformation
import androidx.compose.ui.text.input.TextFieldValue
import androidx.compose.ui.text.input.VisualTransformation
Expand Down Expand Up @@ -130,7 +131,8 @@ fun LoginScreen(
}
},
error = passwordError,
supportingText = passwordErrorContent
supportingText = passwordErrorContent,
keyboardType = KeyboardType.Password
)

Spacer(modifier = Modifier.height(8.dp))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.text.input.PasswordVisualTransformation
import androidx.compose.ui.text.input.TextFieldValue
import androidx.compose.ui.text.input.VisualTransformation
Expand Down Expand Up @@ -178,7 +179,8 @@ fun RegistrationScreen(
IconButton(onClick = { passwordVisibility = !passwordVisibility }) {
Icon(imageVector = image, null)
}
}
},
keyboardType = KeyboardType.Password
)

if (onValueChangePassword) {
Expand Down Expand Up @@ -210,7 +212,8 @@ fun RegistrationScreen(
IconButton(onClick = { confirmPasswordVisibility = !confirmPasswordVisibility }) {
Icon(imageVector = image, null)
}
}
},
keyboardType = KeyboardType.Password
)

Row(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.text.input.TextFieldValue
import androidx.compose.ui.text.input.VisualTransformation
import androidx.compose.ui.unit.dp
Expand All @@ -38,7 +39,8 @@ fun MifosOutlinedTextField(
visualTransformation: VisualTransformation = VisualTransformation.None,
trailingIcon: @Composable (() -> Unit)? = null,
error: Boolean = false,
supportingText: String
supportingText: String,
keyboardType: KeyboardType = KeyboardType.Text
) {

OutlinedTextField(
Expand Down Expand Up @@ -70,7 +72,10 @@ fun MifosOutlinedTextField(
textStyle = LocalDensity.current.run {
TextStyle(fontSize = 18.sp)
},
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Next),
keyboardOptions = KeyboardOptions(
imeAction = ImeAction.Next,
keyboardType = keyboardType
),
visualTransformation = visualTransformation,
isError = error,
supportingText = {
Expand Down

0 comments on commit 319dd87

Please sign in to comment.