Never send passwords to the UI

This commit is contained in:
Deluan 2021-04-29 20:04:01 -04:00
parent 71dc0dddaf
commit eaf40efdf4
4 changed files with 10 additions and 5 deletions

View File

@ -7,13 +7,13 @@ type User struct {
UserName string `json:"userName"`
Name string `json:"name"`
Email string `json:"email"`
Password string `json:"password"`
Password string `json:"-"`
IsAdmin bool `json:"isAdmin"`
LastLoginAt *time.Time `json:"lastLoginAt"`
LastAccessAt *time.Time `json:"lastAccessAt"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
// TODO ChangePassword string `json:"password"`
NewPassword string `json:"password,omitempty"`
}
type Users []User

View File

@ -86,7 +86,8 @@
"updatedAt": "Últ. Atualização",
"name": "Nome",
"password": "Senha",
"createdAt": "Data de Criação"
"createdAt": "Data de Criação",
"changePassword": "Trocar Senha"
},
"helperTexts": {
"name": "Alterações no seu nome só serão refletidas no próximo login"

View File

@ -86,7 +86,8 @@
"updatedAt": "Updated at",
"name": "Name",
"password": "Password",
"createdAt": "Created at"
"createdAt": "Created at",
"changePassword": "Change Password"
},
"helperTexts": {
"name": "Changes to your name will only be reflected on next login"

View File

@ -61,7 +61,10 @@ const UserEdit = (props) => {
{...getNameHelperText()}
/>
<TextInput source="email" validate={[email()]} />
<PasswordInput source="password" validate={[required()]} />
<PasswordInput
source="password"
label={translate('resources.user.fields.changePassword')}
/>
{permissions === 'admin' && (
<BooleanInput source="isAdmin" initialValue={false} />
)}