Merge branch 'feature/openid' into master
continuous-integration/drone/pr Build is passing
Details
continuous-integration/drone/pr Build is passing
Details
This commit is contained in:
commit
df1f3bbcac
|
@ -45,7 +45,7 @@
|
|||
<div class="dropdown is-right is-active">
|
||||
<div class="dropdown-trigger">
|
||||
<button @click.stop="userMenuActive = !userMenuActive" class="button noshadow">
|
||||
<span class="username">{{ userInfo.username }}</span>
|
||||
<span class="username">{{ userInfo.name !== '' ? userInfo.name : userInfo.username }}</span>
|
||||
<span class="icon is-small">
|
||||
<icon icon="chevron-down"/>
|
||||
</span>
|
||||
|
|
|
@ -12,6 +12,7 @@ export default class UserModel extends AbstractModel {
|
|||
id: 0,
|
||||
email: '',
|
||||
username: '',
|
||||
name: '',
|
||||
created: null,
|
||||
updated: null,
|
||||
}
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
|
||||
import AbstractModel from './abstractModel'
|
||||
|
||||
export default class UserNameModel extends AbstractModel {
|
||||
defaults() {
|
||||
return {
|
||||
name: '',
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
|
||||
import AbstractService from './abstractService'
|
||||
|
||||
export default class UserNameService extends AbstractService {
|
||||
constructor() {
|
||||
super({
|
||||
update: '/user/settings/name',
|
||||
})
|
||||
}
|
||||
}
|
|
@ -16,6 +16,9 @@ export default {
|
|||
state.info = info
|
||||
state.avatarUrl = info.getAvatarUrl()
|
||||
},
|
||||
setUserName(state, name) {
|
||||
state.info.name = name
|
||||
},
|
||||
authenticated(state, authenticated) {
|
||||
state.authenticated = authenticated
|
||||
},
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div class="content has-text-centered">
|
||||
<h2>Hi {{ userInfo.username }}!</h2>
|
||||
<h2>Hi {{ userInfo.name !== '' ? userInfo.name : userInfo.username }}!</h2>
|
||||
<template v-if="!hasTasks">
|
||||
<p>Click on a list or namespace on the left to get started.</p>
|
||||
<router-link
|
||||
|
|
|
@ -106,6 +106,38 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Name -->
|
||||
<div class="card">
|
||||
<header class="card-header">
|
||||
<p class="card-header-title">
|
||||
Update your name
|
||||
</p>
|
||||
</header>
|
||||
<div class="card-content">
|
||||
<div class="content">
|
||||
<div class="field">
|
||||
<label class="label" for="newEmail">Name</label>
|
||||
<div class="control">
|
||||
<input
|
||||
@keyup.enter="updateName"
|
||||
class="input"
|
||||
id="newEmail"
|
||||
placeholder="The new name"
|
||||
type="text"
|
||||
v-model="name"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="bigbuttons">
|
||||
<button :class="{ 'is-loading': userNameService.loading}" @click="updateName()"
|
||||
class="button is-primary is-fullwidth">
|
||||
Save
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Avatar -->
|
||||
<avatar-settings/>
|
||||
|
||||
|
@ -234,6 +266,8 @@ import EmailUpdateService from '../../services/emailUpdate'
|
|||
import EmailUpdateModel from '../../models/emailUpdate'
|
||||
import TotpModel from '../../models/totp'
|
||||
import TotpService from '../../services/totp'
|
||||
import UserNameService from '../../services/userName'
|
||||
import UserNameModel from '../../models/userName'
|
||||
|
||||
import {mapState} from 'vuex'
|
||||
|
||||
|
@ -260,6 +294,9 @@ export default {
|
|||
totpDisablePassword: '',
|
||||
|
||||
caldavUrl: '',
|
||||
|
||||
name: '',
|
||||
userNameService: UserNameService,
|
||||
}
|
||||
},
|
||||
components: {
|
||||
|
@ -275,6 +312,9 @@ export default {
|
|||
this.totpService = new TotpService()
|
||||
this.totp = new TotpModel()
|
||||
|
||||
this.userNameService = new UserNameService()
|
||||
this.name = this.$store.state.auth.info.name
|
||||
|
||||
this.totpStatus()
|
||||
this.buildCaldavUrl()
|
||||
},
|
||||
|
@ -359,6 +399,16 @@ export default {
|
|||
})
|
||||
.catch(e => this.error(e, this))
|
||||
},
|
||||
updateName() {
|
||||
const name = new UserNameModel({name: this.name})
|
||||
|
||||
this.userNameService.update(name)
|
||||
.then(() => {
|
||||
this.$store.commit('auth/setUserName', this.name)
|
||||
this.success({message: 'The name was successfully changed.'}, this)
|
||||
})
|
||||
.catch(e => this.error(e, this))
|
||||
},
|
||||
buildCaldavUrl() {
|
||||
const apiBase = window.API_URL.replace('/api/v1', '')
|
||||
this.caldavUrl = `${apiBase}/dav/principals/${this.userInfo.username}/`
|
||||
|
|
Reference in New Issue