@@ -34,6 +34,9 @@ import { setModalErrorSnackMessage } from "../../../actions";
3434import { ErrorResponseHandler } from "../../../common/types" ;
3535import api from "../../../common/api" ;
3636import { ChangePasswordIcon } from "../../../icons" ;
37+ import { decodeFileName } from "../../../common/utils" ;
38+ import RemoveRedEyeIcon from "@mui/icons-material/RemoveRedEye" ;
39+ import VisibilityOffIcon from "@mui/icons-material/VisibilityOff" ;
3740
3841const styles = ( theme : Theme ) =>
3942 createStyles ( {
@@ -60,6 +63,11 @@ const ChangePassword = ({
6063 const [ newPassword , setNewPassword ] = useState < string > ( "" ) ;
6164 const [ reNewPassword , setReNewPassword ] = useState < string > ( "" ) ;
6265 const [ loading , setLoading ] = useState < boolean > ( false ) ;
66+ const [ showPassword , setShowPassword ] = useState < boolean > ( false ) ;
67+
68+ const userLoggedIn = decodeFileName (
69+ localStorage . getItem ( "userLoggedIn" ) || ""
70+ ) ;
6371
6472 const changePassword = ( event : React . FormEvent ) => {
6573 event . preventDefault ( ) ;
@@ -110,7 +118,7 @@ const ChangePassword = ({
110118
111119 return open ? (
112120 < ModalWrapper
113- title = " Change Password"
121+ title = { ` Change Password for ${ userLoggedIn } ` }
114122 modalOpen = { open }
115123 onClose = { ( ) => {
116124 setNewPassword ( "" ) ;
@@ -120,6 +128,9 @@ const ChangePassword = ({
120128 } }
121129 titleIcon = { < ChangePasswordIcon /> }
122130 >
131+ < div >
132+ This will change your Console password. Please note your new password down, as it will be required to log into Console after this session.
133+ </ div >
123134 < form
124135 noValidate
125136 autoComplete = "off"
@@ -137,8 +148,18 @@ const ChangePassword = ({
137148 setCurrentPassword ( event . target . value ) ;
138149 } }
139150 label = "Current Password"
140- type = " password"
151+ type = { showPassword ? "text" : " password"}
141152 value = { currentPassword }
153+ overlayAction = { ( ) =>
154+ setShowPassword ( ! showPassword )
155+ }
156+ overlayIcon = {
157+ showPassword ? (
158+ < VisibilityOffIcon />
159+ ) : (
160+ < RemoveRedEyeIcon />
161+ )
162+ }
142163 />
143164 </ Grid >
144165 < Grid item xs = { 12 } className = { classes . formFieldRow } >
@@ -149,8 +170,18 @@ const ChangePassword = ({
149170 setNewPassword ( event . target . value ) ;
150171 } }
151172 label = "New Password"
152- type = " password"
173+ type = { showPassword ? "text" : " password"}
153174 value = { newPassword }
175+ overlayAction = { ( ) =>
176+ setShowPassword ( ! showPassword )
177+ }
178+ overlayIcon = {
179+ showPassword ? (
180+ < VisibilityOffIcon />
181+ ) : (
182+ < RemoveRedEyeIcon />
183+ )
184+ }
154185 />
155186 </ Grid >
156187 < Grid item xs = { 12 } className = { classes . formFieldRow } >
@@ -161,8 +192,18 @@ const ChangePassword = ({
161192 setReNewPassword ( event . target . value ) ;
162193 } }
163194 label = "Type New Password Again"
164- type = " password"
195+ type = { showPassword ? "text" : " password"}
165196 value = { reNewPassword }
197+ overlayAction = { ( ) =>
198+ setShowPassword ( ! showPassword )
199+ }
200+ overlayIcon = {
201+ showPassword ? (
202+ < VisibilityOffIcon />
203+ ) : (
204+ < RemoveRedEyeIcon />
205+ )
206+ }
166207 />
167208 </ Grid >
168209 </ Grid >
0 commit comments