Skip to content

Commit

Permalink
Merge pull request #10 from passwall/main
Browse files Browse the repository at this point in the history
1.0.2
  • Loading branch information
yakuter authored Mar 13, 2021
2 parents a608019 + 9359f70 commit 69f573b
Show file tree
Hide file tree
Showing 24 changed files with 1,006 additions and 121 deletions.
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "passwall-extension",
"version": "1.0.0",
"version": "1.0.2",
"private": true,
"scripts": {
"serve": "vue-cli-service build --mode development --watch",
Expand Down
6 changes: 5 additions & 1 deletion src/components/ClipboardButton.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<template>
<button type="button" class="clipboard-btn" v-clipboard:copy="copy" v-tooltip="$t('Copy')">
<button
type="button"
class="clipboard-btn"
v-clipboard:copy="copy"
v-tooltip="$t('Copy')">
<VIcon name="duplicate" size="20px" />
</button>
</template>
Expand Down
89 changes: 89 additions & 0 deletions src/components/GeneratePassword.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<template>
<v-popover offset="16">
<button
type="button"
@click="onClickGenerate"
class="btn-generate-pass"
v-tooltip="$t('Generate')">
<VIcon name="refresh" size="20px" />
</button>

<!-- Popover -->
<template slot="popover">
<div class="generate-password">
<span v-text="password" />
<hr />
<VButton size="mini" v-close-popover @click="onClickUseThis">
{{ $t('UseThis') }}
</VButton>
</div>
</template>
</v-popover>
</template>

<script>
import SystemService from '@/api/services/System'
export default {
name: 'GeneratePassword',
props: {
value: String
},
data() {
return {
password: ''
}
},
methods: {
onClickItem(name) {
this.$router.push({ name })
this.$emit('hide')
},
onClickUseThis() {
this.$emit('input', this.password)
},
async onClickGenerate() {
try {
const { data } = await SystemService.GeneratePassword()
this.password = data.message
} catch (err) {
console.log(err)
}
}
}
}
</script>

<style lang="scss">
.btn-generate-pass {
width: 24px;
height: 24px;
border-radius: 4px;
background-color: $color-gray-500;
margin-left: $spacer-2;
color: $color-gray-300;
}
.generate-password {
text-align: center;
border-radius: 4px;
padding: $spacer-3;
background-color: black;
span {
color: #fff;
font-size: 14px;
line-height: 22px;
}
hr {
margin: 12px #{-$spacer-3};
border-bottom: 1px solid $color-gray-500;
}
}
</style>
7 changes: 5 additions & 2 deletions src/components/Header.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
<template>
<div class="d-flex flex-items-center flex-justify-between header px-3" v-bind="$attrs">
<slot name="content">
<div class="d-flex flex-items-center c-pointer" data-testid="settings-click" @click="$emit('header-click')">
<div
class="d-flex flex-items-center c-pointer"
data-testid="settings-click"
@click="$emit('header-click')"
>
<VAvatar :name="user.name" class="mr-1" />
<div class="d-flex flex-column ml-2 mt-1">
<span class="fs-x-big fw-semibold ff-inter" data-testid="username-label">{{
Expand All @@ -11,7 +15,6 @@
<span class="fs-x-big fw-semibold ff-inter c-secondary">{{
hasProPlan ? 'PRO' : 'FREE'
}}</span>
<span class="fs-x-big fw-semibold ff-inter h6 c-gray-300 ml-1">9 days left</span>
</div>
</div>
</div>
Expand Down
30 changes: 30 additions & 0 deletions src/components/TheIcons.vue
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,36 @@
fill="#FF5151"
/>
</symbol>
<symbol
id="upgrade"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M3.95156 11.6485C3.7266 11.4235 3.60022 11.1183 3.60022 10.8001C3.60022 10.4819 3.7266 10.1768 3.95156 9.95173L11.1516 2.75173C11.3766 2.52677 11.6818 2.40039 12 2.40039C12.3182 2.40039 12.6233 2.52677 12.8484 2.75173L20.0484 9.95173C20.267 10.1781 20.3879 10.4812 20.3852 10.7958C20.3824 11.1104 20.2562 11.4114 20.0337 11.6339C19.8113 11.8564 19.5103 11.9826 19.1956 11.9853C18.881 11.9881 18.5779 11.8671 18.3516 11.6485L13.2 6.49693V20.4001C13.2 20.7184 13.0735 21.0236 12.8485 21.2487C12.6234 21.4737 12.3182 21.6001 12 21.6001C11.6817 21.6001 11.3765 21.4737 11.1514 21.2487C10.9264 21.0236 10.8 20.7184 10.8 20.4001V6.49693L5.64836 11.6485C5.42333 11.8735 5.11816 11.9999 4.79996 11.9999C4.48177 11.9999 4.1766 11.8735 3.95156 11.6485Z"
fill="#00FFD1"
/>
</symbol>
<symbol
id="cross"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M5.15164 5.1515C5.37667 4.92654 5.68184 4.80016 6.00004 4.80016C6.31823 4.80016 6.6234 4.92654 6.84844 5.1515L12 10.3031L17.1516 5.1515C17.2623 5.03689 17.3947 4.94547 17.5412 4.88258C17.6876 4.81969 17.845 4.78659 18.0044 4.7852C18.1637 4.78382 18.3217 4.81418 18.4692 4.87452C18.6167 4.93485 18.7506 5.02396 18.8633 5.13663C18.976 5.2493 19.0651 5.38328 19.1254 5.53076C19.1858 5.67823 19.2161 5.83625 19.2147 5.99558C19.2134 6.15492 19.1803 6.31238 19.1174 6.45879C19.0545 6.60519 18.963 6.73761 18.8484 6.8483L13.6968 11.9999L18.8484 17.1515C19.067 17.3778 19.188 17.6809 19.1852 17.9956C19.1825 18.3102 19.0563 18.6112 18.8338 18.8337C18.6113 19.0562 18.3104 19.1824 17.9957 19.1851C17.6811 19.1878 17.378 19.0669 17.1516 18.8483L12 13.6967L6.84844 18.8483C6.62211 19.0669 6.31899 19.1878 6.00436 19.1851C5.68972 19.1824 5.38874 19.0562 5.16625 18.8337C4.94376 18.6112 4.81756 18.3102 4.81483 17.9956C4.81209 17.6809 4.93305 17.3778 5.15164 17.1515L10.3032 11.9999L5.15164 6.8483C4.92667 6.62327 4.80029 6.3181 4.80029 5.9999C4.80029 5.68171 4.92667 5.37654 5.15164 5.1515Z"
fill="white"
/>
</symbol>
</defs>
</svg>
</template>
Expand Down
8 changes: 4 additions & 4 deletions src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"manifest_version": 2,
"name": "__MSG_extName__",
"homepage_url": "http://localhost:8080/",
"description": "Passwall official extension",
"name": "Passwall - Free Password Manager",
"homepage_url": "https://passwall.io",
"description": "Passwall is an open source password manager",
"default_locale": "en",
"permissions": ["tabs", "activeTab", "<all_urls>", "*://*/*", "webRequest"],
"icons": {
Expand All @@ -22,7 +22,7 @@
],
"browser_action": {
"default_popup": "popup.html",
"default_title": "__MSG_extName__",
"default_title": "Passwall - Free Password Manager",
"default_icon": {
"19": "icons/19.png",
"38": "icons/38.png"
Expand Down
2 changes: 1 addition & 1 deletion src/popup/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Vue.prototype.$request = async (callback, waitKey, errorCallback = null) => {

if (error.response) {
if (error.response.status === 401 && !router.app._route.meta.auth) {
store.dispatch('Logout')
await store.dispatch('Logout')
return router.push({ name: 'Login' })
}

Expand Down
5 changes: 5 additions & 0 deletions src/popup/router/clear-search.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import store from '@p/store'

export default () => {
store.commit('onInputSearchQuery', { target: { value: '' } })
}
2 changes: 2 additions & 0 deletions src/popup/router/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Vue from 'vue'
import Router from 'vue-router'
import AuthCheck from './auth-check'
import ClearSearch from '@p/router/clear-search'

Vue.use(Router)

Expand Down Expand Up @@ -123,6 +124,7 @@ router.afterEach((to, from) => {
const fromDepth = from.path.split('/').length
to.meta.transitionName = toDepth < fromDepth ? 'slide-right' : 'slide-left'
})
router.afterEach(ClearSearch)

router.beforeEach(AuthCheck)

Expand Down
24 changes: 22 additions & 2 deletions src/popup/views/Auth/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,17 @@
@submit.stop.prevent="onLogin"
data-testid="login-form"
>
<label v-text="$t('EMailAddress')" class="mb-2" />
<label v-text="$t('ServerURL')" class="mb-2" />
<VFormText
v-model="LoginForm.server"
size="medium"
name="server"
v-validate="'required'"
:placeholder="$t('ServerURL')"
data-testid="server"
/>

<label v-text="$t('EMailAddress')" class="mb-2 mt-4" />
<VFormText
v-model="LoginForm.email"
size="medium"
Expand All @@ -19,7 +29,7 @@
data-testid="username"
/>

<label class="mb-2 mt-4" v-text="$t('MasterPassword')" />
<label v-text="$t('MasterPassword')" class="mb-2 mt-4" />
<VFormText
v-model="LoginForm.master_password"
size="medium"
Expand Down Expand Up @@ -57,12 +67,14 @@

<script>
import { mapActions } from 'vuex'
import HTTPClient from '@/api/HTTPClient'
export default {
name: 'Login',
data() {
return {
LoginForm: {
server: 'https://vault.passwall.io',
email: '',
master_password: ''
}
Expand All @@ -71,23 +83,31 @@ export default {
mounted() {
this.$storage.getItem('email').then(e => {
if (e) this.LoginForm.email = e
}),
this.$storage.getItem('server').then(e => {
if (e) this.LoginForm.server = e
})
},
methods: {
...mapActions(['Login']),
async onLogin() {
if (!(await this.$validator.validateAll())) return
HTTPClient.setBaseURL(this.LoginForm.server)
const onError = error => {
let text = this.$t('Ooops! Something went wrong!')
if (error.response.status == 401) {
text = this.$t(error.response.data.message)
}
this.$notifyError(text)
}
const onSuccess = async () => {
await this.Login({ ...this.LoginForm })
this.$router.replace({ name: 'Home' })
}
this.$request(onSuccess, this.$waiters.Auth.Login, onError)
},
Expand Down
3 changes: 2 additions & 1 deletion src/popup/views/BankAccounts/detail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ export default {
if (index !== -1) {
this.ItemList.splice(index, 1)
}
this.$router.push({ name: 'BankAccounts', params: { cache: true } })
if (confirm('Are you sure you want to delete'))
this.$router.push({ name: 'BankAccounts', params: { cache: true } })
}
this.$request(onSuccess, this.$waiters.BankAccounts.Delete)
Expand Down
39 changes: 13 additions & 26 deletions src/popup/views/CreditCards/detail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<span class="title fw-bold h5 ml-2">{{ form.title }}</span>
</div>
<div class="d-flex">

<!-- Delete Btn -->
<button v-tooltip="$t('Delete')" @click="onClickDelete">
<VIcon class="c-pointer trash" name="trash" />
Expand All @@ -19,41 +18,30 @@
<button v-if="!isEditMode" v-tooltip="$t('Edit')" @click="isEditMode = true">
<VIcon class="c-pointer ml-2 cogs" name="cogs" />
</button>

</div>
</div>
</template>
</Header>
<div class="scroll detail">
<form class="form" @submit.stop.prevent="onClickUpdate">
<FormRowText
v-model="form.title"
title="title"
:edit-mode="isEditMode"
:show-icons="false"
>
<FormRowText v-model="form.title" title="title" :edit-mode="isEditMode" :show-icons="false">
<template v-slot:second-icon> <div /> </template>
</FormRowText>
<FormRowText
v-model="form.cardholder_name"
title="cardholder name"
:edit-mode="isEditMode"
<FormRowText
v-model="form.cardholder_name"
title="cardholder name"
:edit-mode="isEditMode"
:show-icons="true"
>
<template v-slot:second-icon> <div /> </template>
</FormRowText>
<FormRowText
v-model="form.type"
title="type"
:edit-mode="isEditMode"
:show-icons="true"
>
<FormRowText v-model="form.type" title="type" :edit-mode="isEditMode" :show-icons="true">
<template v-slot:second-icon> <div /> </template>
</FormRowText>
<FormRowText
v-model="form.number"
title="number"
:edit-mode="isEditMode"
<FormRowText
v-model="form.number"
title="number"
:edit-mode="isEditMode"
:show-icons="true"
>
<template v-slot:second-icon> <div /> </template>
Expand Down Expand Up @@ -83,7 +71,6 @@
{{ $t('Save') }}
</VButton>
</div>

</form>
</div>
</div>
Expand Down Expand Up @@ -131,8 +118,8 @@ export default {
}
this.$router.push({ name: 'CreditCards', params: { cache: true } })
}
this.$request(onSuccess, this.$waiters.CreditCards.Delete)
if (confirm('Are you sure you want to delete'))
this.$request(onSuccess, this.$waiters.CreditCards.Delete)
},
async onClickUpdate() {
Expand Down Expand Up @@ -160,7 +147,7 @@ export default {
color: $color-danger;
}
.cogs {
color: #FFFFFF;
color: #ffffff;
}
.title {
flex: 1;
Expand Down
1 change: 1 addition & 0 deletions src/popup/views/Emails/create.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
:type="showPass ? 'text' : 'password'"
/>
<div class="d-flex flex-items-center mr-3">
<GeneratePassword v-model="form.password" />
<ClipboardButton :copy="form.password" />
<ShowPassButton @click="showPass = $event" />
</div>
Expand Down
Loading

0 comments on commit 69f573b

Please sign in to comment.