3
3
<base-bottom-sheet-layer
4
4
:title =" $t('pages.user_edit_user_data.title')"
5
5
title-en =" USER SETTING"
6
- fullscreen
7
6
>
8
7
<template v-slot :LayerContents >
9
8
<dl >
10
9
<dt class =" SignUp-ItemTitle" >
11
10
{{ $t('common.user_data.labels.nickname') }}
12
11
</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 >
20
23
</dd >
21
24
<dt class =" SignUp-ItemTitle" >
22
25
{{ $t('common.user_data.labels.email') }}
23
26
</dt >
24
- <dd >
25
- <base-input-field
26
- v-model =" email"
27
- label =" email"
28
-
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 >
32
38
</dd >
33
39
<dt class =" SignUp-ItemTitle" >
34
- {{ $t('pages.user_edit_user_data .labels.old_password ') }}
40
+ {{ $t('common.user_data .labels.password ') }}
35
41
</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 >
43
53
</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 >
70
54
</dl >
71
55
</template >
72
56
<template v-slot :LayerFooter >
77
61
class =" SignUp-Button"
78
62
@click =" $router.push('/edit')"
79
63
/>
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 >
88
75
</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 >
100
76
</template >
101
77
</base-bottom-sheet-layer >
102
78
<v-snackbar v-model =" error" :timeout =" 5000" top color =" #C01B61" >
109
85
import Vue from ' vue'
110
86
import BaseBottomSheetLayer from ' @/components/BaseBottomSheetLayer.vue'
111
87
import BaseActionButton from ' @/components/BaseActionButton.vue'
112
- import BaseInputField from ' @/components/BaseInputField.vue'
113
- import { Auth } from ' aws-amplify'
114
88
import { vxm } from ' ~/store'
115
89
116
90
type Data = {
117
91
name: typeof vxm .user .displayName
118
92
email: typeof vxm .user .email
119
- oldPassword: string
120
- newPassword: string
121
- confirmation: string
122
93
error: boolean
123
- completion: boolean
124
94
loading: boolean
125
95
}
126
96
127
97
type Methods = {
128
- doSave(): void
129
98
doLogout(): void
130
99
}
131
100
@@ -135,93 +104,23 @@ type Computed = {
135
104
}
136
105
137
106
export default Vue .extend <Data , Methods , Computed , unknown >({
138
- components: { BaseBottomSheetLayer , BaseActionButton , BaseInputField },
107
+ components: { BaseBottomSheetLayer , BaseActionButton },
139
108
layout: ' background' ,
140
109
middleware: ' authenticated' ,
141
110
data() {
142
111
return {
143
112
name: vxm .user .displayName ,
144
113
email: vxm .user .email ,
145
- oldPassword: ' ' ,
146
- newPassword: ' ' ,
147
- confirmation: ' ' ,
148
114
error: false ,
149
- completion: false ,
150
115
loading: false ,
151
116
}
152
117
},
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
186
122
},
187
123
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
- },
225
124
async doLogout(): Promise <void > {
226
125
try {
227
126
await vxm .user .logout ()
@@ -236,42 +135,34 @@ export default Vue.extend<Data, Methods, Computed, unknown>({
236
135
</script >
237
136
238
137
<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
+ }
239
145
.SignUp-ItemTitle {
240
146
font-size : 16px ;
241
147
font-weight : bold ;
242
148
color : $color-white ;
243
149
text-align : center ;
244
150
margin : 4px 0 ;
245
151
}
246
- .SignUp-PasswordRules {
247
- text-align : center ;
248
- font-weight : bold ;
249
- color : $color-yellow ;
152
+ .SignUp-ItemButton {
153
+ margin-bottom : 24px ;
250
154
}
251
155
.SignUp-ButtonOuter {
252
156
display : flex ;
253
- justify-content : space-between ;
157
+ flex-flow : column ;
158
+ align-items : center ;
254
159
}
255
160
.SignUp-Button {
256
- flex : 0 1 48% ;
257
- }
258
- .Dialog {
259
- margin : auto !important ;
161
+ width : 8em ;
162
+ margin-bottom : 16px ;
260
163
}
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 ;
276
167
}
277
168
</style >
0 commit comments