Skip to content

Commit 6c874b2

Browse files
authored
Merge pull request #443 from kaizumaki/feature/issue-427-fix-ui-user-setting
ユーザー情報変更ページのUI修正
2 parents 8bc3a0b + b3d400e commit 6c874b2

File tree

8 files changed

+626
-191
lines changed

8 files changed

+626
-191
lines changed

src/assets/locales/ja.json

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"logout": "ログアウト",
1010
"ok": "OK",
1111
"save": "保存する",
12+
"change": "変更する",
1213
"verify": "認証する"
1314
},
1415
"error": {
@@ -154,11 +155,28 @@
154155
"no_classes": "編集可能なクラスがありません。クラスの登録を行ってください"
155156
},
156157
"user_edit_user_data": {
157-
"title": "ユーザー情報の変更",
158+
"title": "ユーザー情報の変更"
159+
},
160+
"user_edit_user_name": {
161+
"title": "お名前(表示名)の変更",
162+
"labels": {
163+
"current_nickname": "現在のお名前(表示名)",
164+
"new_nickname": "変更後のお名前(表示名)"
165+
}
166+
},
167+
"user_edit_user_email": {
168+
"title": "メールアドレスの変更",
169+
"labels": {
170+
"current_email": "現在のメールアドレス",
171+
"new_email": "変更後のメールアドレス"
172+
}
173+
},
174+
"user_edit_user_password": {
175+
"title": "パスワードの変更",
158176
"labels": {
159-
"old_password": "現在のパスワード",
160-
"new_password": "変更先パスワード",
161-
"new_password_confirm": "変更先パスワード(確認用)"
177+
"current_password": "現在のパスワードを入力してください",
178+
"new_password": "変更後のパスワード",
179+
"new_password_confirm": "パスワード(確認用)"
162180
}
163181
},
164182
"user_login": {

src/components/BaseBottomSheetLayer.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ export default Vue.extend({
7878
.Layer-FormContainer {
7979
height: 100%;
8080
padding: 0 !important;
81+
overflow: auto;
8182
}
8283
.Layer-Container {
8384
padding: 0;

src/pages/user/editUserData.vue

Lines changed: 66 additions & 175 deletions
Original file line numberDiff line numberDiff line change
@@ -3,70 +3,54 @@
33
<base-bottom-sheet-layer
44
:title="$t('pages.user_edit_user_data.title')"
55
title-en="USER SETTING"
6-
fullscreen
76
>
87
<template v-slot:LayerContents>
98
<dl>
109
<dt class="SignUp-ItemTitle">
1110
{{ $t('common.user_data.labels.nickname') }}
1211
</dt>
13-
<dd>
14-
<base-input-field
15-
v-model="name"
16-
label="name"
17-
placeholder="山田花子"
18-
require
19-
/>
12+
<dd class="SignUp-ItemButton">
13+
<v-btn
14+
block
15+
color="white"
16+
height="auto"
17+
class="ToEditNavButton"
18+
@click="$router.push('/user/editUserName')"
19+
>
20+
{{ name }}
21+
<v-icon right color="#0071C2"> mdi-chevron-right </v-icon>
22+
</v-btn>
2023
</dd>
2124
<dt class="SignUp-ItemTitle">
2225
{{ $t('common.user_data.labels.email') }}
2326
</dt>
24-
<dd>
25-
<base-input-field
26-
v-model="email"
27-
label="email"
28-
placeholder="[email protected]"
29-
type="email"
30-
require
31-
/>
27+
<dd class="SignUp-ItemButton">
28+
<v-btn
29+
block
30+
color="white"
31+
height="auto"
32+
class="ToEditNavButton"
33+
@click="$router.push('/user/editUserEmail')"
34+
>
35+
{{ email }}
36+
<v-icon right color="#0071C2"> mdi-chevron-right </v-icon>
37+
</v-btn>
3238
</dd>
3339
<dt class="SignUp-ItemTitle">
34-
{{ $t('pages.user_edit_user_data.labels.old_password') }}
40+
{{ $t('common.user_data.labels.password') }}
3541
</dt>
36-
<dd>
37-
<base-input-field
38-
v-model="oldPassword"
39-
label="password"
40-
type="password"
41-
require
42-
/>
42+
<dd class="SignUp-ItemButton">
43+
<v-btn
44+
block
45+
color="white"
46+
height="auto"
47+
class="ToEditNavButton"
48+
@click="$router.push('/user/editUserPassword')"
49+
>
50+
********
51+
<v-icon right color="#0071C2"> mdi-chevron-right </v-icon>
52+
</v-btn>
4353
</dd>
44-
<dt class="SignUp-ItemTitle">
45-
{{ $t('pages.user_edit_user_data.labels.new_password') }}
46-
</dt>
47-
<dt class="SignUp-PasswordRules">
48-
{{ $t('common.user_data.labels.password_rules') }}
49-
</dt>
50-
<dd>
51-
<base-input-field
52-
v-model="newPassword"
53-
label="new password"
54-
type="password"
55-
require
56-
/>
57-
</dd>
58-
<dt class="SignUp-ItemTitle">
59-
{{ $t('pages.user_edit_user_data.labels.new_password_confirm') }}
60-
</dt>
61-
<dd>
62-
<base-input-field
63-
v-model="confirmation"
64-
label="confirmation"
65-
type="password"
66-
require
67-
/>
68-
</dd>
69-
<dt class="SignUp-ItemTitle text--red">{{ passwordConfirm }}</dt>
7054
</dl>
7155
</template>
7256
<template v-slot:LayerFooter>
@@ -77,26 +61,18 @@
7761
class="SignUp-Button"
7862
@click="$router.push('/edit')"
7963
/>
80-
<base-action-button
81-
theme="primary"
82-
:text="$t('common.general.buttons.save')"
83-
class="SignUp-Button"
84-
:is-disabled="disableRegisterButton"
85-
:is-loading="loading"
86-
@click="doSave"
87-
/>
64+
<v-btn
65+
:disabled="loading"
66+
class="LogoutButton"
67+
color="#fff"
68+
height="60px"
69+
text
70+
@click="doLogout"
71+
>
72+
{{ $t('common.general.buttons.logout') }}
73+
<v-icon right color="#fff"> mdi-logout-variant </v-icon>
74+
</v-btn>
8875
</div>
89-
<v-btn
90-
:disabled="loading"
91-
block
92-
class="button"
93-
color="#ffffff"
94-
height="60px"
95-
text
96-
@click="doLogout"
97-
>
98-
<span>{{ $t('common.general.buttons.logout') }}</span>
99-
</v-btn>
10076
</template>
10177
</base-bottom-sheet-layer>
10278
<v-snackbar v-model="error" :timeout="5000" top color="#C01B61">
@@ -109,23 +85,16 @@
10985
import Vue from 'vue'
11086
import BaseBottomSheetLayer from '@/components/BaseBottomSheetLayer.vue'
11187
import BaseActionButton from '@/components/BaseActionButton.vue'
112-
import BaseInputField from '@/components/BaseInputField.vue'
113-
import { Auth } from 'aws-amplify'
11488
import { vxm } from '~/store'
11589
11690
type Data = {
11791
name: typeof vxm.user.displayName
11892
email: typeof vxm.user.email
119-
oldPassword: string
120-
newPassword: string
121-
confirmation: string
12293
error: boolean
123-
completion: boolean
12494
loading: boolean
12595
}
12696
12797
type Methods = {
128-
doSave(): void
12998
doLogout(): void
13099
}
131100
@@ -135,93 +104,23 @@ type Computed = {
135104
}
136105
137106
export default Vue.extend<Data, Methods, Computed, unknown>({
138-
components: { BaseBottomSheetLayer, BaseActionButton, BaseInputField },
107+
components: { BaseBottomSheetLayer, BaseActionButton },
139108
layout: 'background',
140109
middleware: 'authenticated',
141110
data() {
142111
return {
143112
name: vxm.user.displayName,
144113
email: vxm.user.email,
145-
oldPassword: '',
146-
newPassword: '',
147-
confirmation: '',
148114
error: false,
149-
completion: false,
150115
loading: false,
151116
}
152117
},
153-
computed: {
154-
passwordConfirm() {
155-
if (this.newPassword) {
156-
// 6文字以上であること
157-
const reg = new RegExp(/[ -~]{6,}$/)
158-
const response = reg.test(this.newPassword)
159-
if (!response) {
160-
return this.$t(
161-
'common.user_data.labels.password_not_acceptable'
162-
).toString()
163-
}
164-
}
165-
if (this.newPassword && this.confirmation) {
166-
if (this.newPassword !== this.confirmation) {
167-
return this.$t('common.user_data.labels.password_not_same').toString()
168-
}
169-
return ''
170-
}
171-
return ''
172-
},
173-
disableRegisterButton() {
174-
if (this.email || this.name) {
175-
return false
176-
}
177-
if (this.oldPassword && this.newPassword === this.confirmation) {
178-
const reg = new RegExp(/[ -~]{6,}$/)
179-
const response = reg.test(this.newPassword)
180-
if (response) {
181-
return false
182-
}
183-
}
184-
return true
185-
},
118+
async mounted() {
119+
await vxm.user.login()
120+
this.name = vxm.user.displayName
121+
this.email = vxm.user.email
186122
},
187123
methods: {
188-
async doSave(): Promise<void> {
189-
this.loading = true
190-
const user = await Auth.currentAuthenticatedUser()
191-
if (user) {
192-
if (this.email !== vxm.user.email) {
193-
try {
194-
await Auth.updateUserAttributes(user, {
195-
email: this.email,
196-
})
197-
await this.$router.push('/user/verifyNewEmail')
198-
} catch {
199-
this.error = true
200-
this.loading = false
201-
}
202-
}
203-
if (this.name !== vxm.user.displayName) {
204-
try {
205-
await Auth.updateUserAttributes(user, {
206-
name: this.name,
207-
})
208-
await this.$router.push('/edit')
209-
} catch {
210-
this.error = true
211-
this.loading = false
212-
}
213-
}
214-
if (this.newPassword) {
215-
try {
216-
await Auth.changePassword(user, this.oldPassword, this.newPassword)
217-
await this.$router.push('/edit')
218-
} catch {
219-
this.error = true
220-
this.loading = false
221-
}
222-
}
223-
}
224-
},
225124
async doLogout(): Promise<void> {
226125
try {
227126
await vxm.user.logout()
@@ -236,42 +135,34 @@ export default Vue.extend<Data, Methods, Computed, unknown>({
236135
</script>
237136

238137
<style lang="scss" scoped>
138+
.ToEditNavButton {
139+
justify-content: space-between;
140+
font-size: 18px;
141+
border-radius: 14px;
142+
padding: 16px !important;
143+
text-transform: none;
144+
}
239145
.SignUp-ItemTitle {
240146
font-size: 16px;
241147
font-weight: bold;
242148
color: $color-white;
243149
text-align: center;
244150
margin: 4px 0;
245151
}
246-
.SignUp-PasswordRules {
247-
text-align: center;
248-
font-weight: bold;
249-
color: $color-yellow;
152+
.SignUp-ItemButton {
153+
margin-bottom: 24px;
250154
}
251155
.SignUp-ButtonOuter {
252156
display: flex;
253-
justify-content: space-between;
157+
flex-flow: column;
158+
align-items: center;
254159
}
255160
.SignUp-Button {
256-
flex: 0 1 48%;
257-
}
258-
.Dialog {
259-
margin: auto !important;
161+
width: 8em;
162+
margin-bottom: 16px;
260163
}
261-
.v-dialog {
262-
.DialogCard {
263-
border-radius: 14px;
264-
265-
&Title,
266-
&Buttons {
267-
flex-direction: column;
268-
}
269-
270-
&Title,
271-
&TitleIcon {
272-
color: $color-base-color-01;
273-
font-size: 16px;
274-
}
275-
}
164+
.LogoutButton {
165+
font-size: 18px;
166+
font-weight: bold;
276167
}
277168
</style>

0 commit comments

Comments
 (0)