Skip to content

Commit

Permalink
avniproject/avni-security#41 - login fields autocomplete based on env…
Browse files Browse the repository at this point in the history
…ironment. removed unused env var.
  • Loading branch information
petmongrels committed Sep 13, 2023
1 parent e59e76d commit ea8730e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 0 additions & 2 deletions .env.development
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
PORT=6010
REACT_APP_ENVIRONMENT=development
REACT_APP_MEDIA_VIEWER_ENABLED=true
REACT_APP_MEDIA_APP_URL=http://localhost:3000
1 change: 0 additions & 1 deletion src/common/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import ApplicationContext from "../ApplicationContext";
export const isDevEnv = ApplicationContext.isDevEnv();
export const isProdEnv = ApplicationContext.isProdEnv();
export const devEnvUserName = process.env.REACT_APP_DEV_ENV_USER;
export const isMediaViewerEnabled = process.env.REACT_APP_MEDIA_VIEWER_ENABLED === "true";

//Set by testing tools like Jest
export const isTestEnv = process.env.NODE_ENV === "test";
Expand Down
9 changes: 9 additions & 0 deletions src/rootApp/views/SignInView.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import Typography from "@material-ui/core/Typography";
import React, { useState } from "react";
import SideImage from "../../avni-background.jpeg";
import { withStyles } from "@material-ui/core/styles";
import ApplicationContext from "../../ApplicationContext";

function SignInView({
classes,
Expand All @@ -27,6 +28,7 @@ function SignInView({
disallowForgottenPasswordReset = false
}) {
const [passwordIsMasked, setPasswordIsMasked] = useState(true);
const autoComplete = ApplicationContext.isDevEnv() ? "on" : "off";

return (
<Grid container component="main" className={classes.root}>
Expand All @@ -49,6 +51,12 @@ function SignInView({
<form className={classes.form} noValidate>
<TextField
variant="outlined"
inputProps={{
autocomplete: autoComplete,
form: {
autocomplete: autoComplete
}
}}
margin="normal"
required
fullWidth
Expand All @@ -71,6 +79,7 @@ function SignInView({
type={passwordIsMasked ? "password" : "text"}
onChange={notifyInputChange}
id="password"
autoComplete={autoComplete}
InputProps={{
endAdornment: (
<InputAdornment position="end">
Expand Down

0 comments on commit ea8730e

Please sign in to comment.