Skip to content

Commit 2ca4772

Browse files
authored
Merge pull request #44 from CodeDead/feature/vault-user
feature/vault-user
2 parents a6a14a0 + 805cdbf commit 2ca4772

File tree

10 files changed

+51
-13
lines changed

10 files changed

+51
-13
lines changed

src/components/CreatePasswordDialog/index.jsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ const CreatePasswordDialog = ({ open, onCreate, onClose }) => {
3939
const [title, setTitle] = useState('');
4040
const [description, setDescription] = useState('');
4141
const [url, setUrl] = useState('');
42+
const [username, setUsername] = useState('');
4243
const [password, setPassword] = useState('');
4344
const [showPassword, setShowPassword] = useState(false);
4445

@@ -67,14 +68,15 @@ const CreatePasswordDialog = ({ open, onCreate, onClose }) => {
6768
setDescription('');
6869
setUrl('');
6970
setPassword('');
71+
setUsername('');
7072
};
7173

7274
/**
7375
* Create a new vault
7476
*/
7577
const create = () => {
7678
if (onCreate) {
77-
onCreate(title, description, url, password);
79+
onCreate(title, description, url, username, password);
7880
}
7981
handleClose();
8082
};
@@ -151,6 +153,18 @@ const CreatePasswordDialog = ({ open, onCreate, onClose }) => {
151153
fullWidth
152154
/>
153155
</Grid>
156+
<Grid item xs={12} md={12} lg={12}>
157+
<TextField
158+
value={username}
159+
type="text"
160+
label={language.username}
161+
onChange={(e) => setUsername(e.target.value)}
162+
onKeyUp={handleKeyUp}
163+
autoComplete="off"
164+
variant="outlined"
165+
fullWidth
166+
/>
167+
</Grid>
154168
<Grid item xs={12} md={8} lg={8}>
155169
<TextField
156170
value={password}

src/components/EditPasswordDialog/index.jsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ const EditPasswordDialog = ({
4242
const [description, setDescription] = useState(data && data.description ? data.description : '');
4343
const [url, setUrl] = useState(data && data.url ? data.url : '');
4444
const [password, setPassword] = useState(data && data.password ? data.password : '');
45+
const [username, setUsername] = useState(data && data.username ? data.username : '');
4546
const [showPassword, setShowPassword] = useState(false);
4647

4748
const simpleCharacterSet = getFullCharacterSet(
@@ -72,7 +73,7 @@ const EditPasswordDialog = ({
7273
*/
7374
const save = () => {
7475
if (onSave) {
75-
onSave(data.id, title, description, url, password);
76+
onSave(data.id, title, description, url, username, password);
7677
}
7778
handleClose();
7879
};
@@ -149,6 +150,18 @@ const EditPasswordDialog = ({
149150
fullWidth
150151
/>
151152
</Grid>
153+
<Grid item xs={12} md={12} lg={12}>
154+
<TextField
155+
value={username}
156+
type="text"
157+
label={language.username}
158+
onChange={(e) => setUsername(e.target.value)}
159+
onKeyUp={handleKeyUp}
160+
autoComplete="off"
161+
variant="outlined"
162+
fullWidth
163+
/>
164+
</Grid>
152165
<Grid item xs={12} md={8} lg={8}>
153166
<TextField
154167
value={password}

src/languages/de_de.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,5 +99,6 @@
9999
"close": "Schließen",
100100
"copy": "Kopieren",
101101
"createOrOpenVault": "Erstellen oder öffnen Sie einen Tresor",
102-
"selectFile": "Datei auswählen"
102+
"selectFile": "Datei auswählen",
103+
"username": "Benutzername"
103104
}

src/languages/en_us.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,5 +99,6 @@
9999
"close": "Close",
100100
"copy": "Copy",
101101
"createOrOpenVault": "Create or open a vault",
102-
"selectFile": "Select file"
102+
"selectFile": "Select file",
103+
"username": "Username"
103104
}

src/languages/fr_fr.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,5 +99,6 @@
9999
"close": "Fermer",
100100
"copy": "Copier",
101101
"createOrOpenVault": "Créer ou ouvrir un coffre-fort",
102-
"selectFile": "Sélectionner un fichier"
102+
"selectFile": "Sélectionner un fichier",
103+
"username": "Nom d'utilisateur"
103104
}

src/languages/jp_jp.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,5 +99,6 @@
9999
"close": "閉じる",
100100
"copy": "コピー",
101101
"createOrOpenVault": "金庫を作成または開く",
102-
"selectFile": "ファイルを選択"
102+
"selectFile": "ファイルを選択",
103+
"username": "ユーザー名"
103104
}

src/languages/nl_nl.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,5 +99,6 @@
9999
"close": "Sluiten",
100100
"copy": "Kopiëren",
101101
"createOrOpenVault": "Maak een nieuwe kluis of open een bestaande kluis",
102-
"selectFile": "Selecteer een bestand"
102+
"selectFile": "Selecteer een bestand",
103+
"username": "Gebruikersnaam"
103104
}

src/languages/ru_ru.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,5 +99,6 @@
9999
"close": "Закрыть",
100100
"copy": "Копировать",
101101
"createOrOpenVault": "Создать или открыть сейф",
102-
"selectFile": "Выбрать файл"
102+
"selectFile": "Выбрать файл",
103+
"username": "Имя пользователя"
103104
}

src/languages/zh_cn.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,5 +99,6 @@
9999
"close": "关闭",
100100
"copy": "复制",
101101
"createOrOpenVault": "创建或打开保险库",
102-
"selectFile": "选择文件"
102+
"selectFile": "选择文件",
103+
"username": "用户名"
103104
}

src/routes/Vault/index.jsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,14 @@ const Vault = () => {
141141
* @param title The title
142142
* @param description The description
143143
* @param url The URL
144+
* @param username The username
144145
* @param password The password
145146
*/
146-
const addPassword = (title, description, url, password) => {
147+
const addPassword = (title, description, url, username, password) => {
147148
const id = uuidv4();
148149
const newVault = JSON.parse(JSON.stringify(vault));
149150
newVault.push({
150-
id, title, description, url, password,
151+
id, title, description, url, username, password,
151152
});
152153
d3(setVault(newVault));
153154
};
@@ -202,14 +203,16 @@ const Vault = () => {
202203
* @param title The new title
203204
* @param description The new description
204205
* @param url The new URL
206+
* @param username The new username
205207
* @param password The new password
206208
*/
207-
const editPassword = (id, title, description, url, password) => {
209+
const editPassword = (id, title, description, url, username, password) => {
208210
const newVault = JSON.parse(JSON.stringify(vault));
209211
newVault.filter((e) => e.id === id).forEach((e) => {
210212
e.title = title;
211213
e.description = description;
212214
e.url = url;
215+
e.username = username;
213216
e.password = password;
214217
});
215218
d3(setVault(newVault));
@@ -281,7 +284,8 @@ const Vault = () => {
281284
const filteredVault = search && search.length > 0
282285
? vault.filter((e) => e.title.toLowerCase().includes(search.toLowerCase())
283286
|| e.description.toLowerCase().includes(search.toLowerCase())
284-
|| e.url.toLowerCase().includes(search.toLowerCase()))
287+
|| e.url.toLowerCase().includes(search.toLowerCase())
288+
|| e.username.toLowerCase().includes(search.toLowerCase()))
285289
: vault;
286290

287291
if (!filteredVault || filteredVault.length === 0) {

0 commit comments

Comments
 (0)