-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into attachments-modal
- Loading branch information
Showing
50 changed files
with
2,079 additions
and
1,040 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<!-- | ||
Copyright 2017 ODK Central Developers | ||
See the NOTICE file at the top-level directory of this distribution and at | ||
https://github.com/opendatakit/central-frontend/blob/master/NOTICE. | ||
|
||
This file is part of ODK Central. It is subject to the license terms in | ||
the LICENSE file found in the top-level directory of this distribution and at | ||
https://www.apache.org/licenses/LICENSE-2.0. No part of ODK Central, | ||
including this file, may be copied, modified, propagated, or distributed | ||
except according to the terms contained in the LICENSE file. | ||
--> | ||
<template> | ||
<div> | ||
<page-head> | ||
<template slot="title">{{ displayName }}</template> | ||
</page-head> | ||
<page-body> | ||
<div class="row"> | ||
<div class="col-xs-7"> | ||
<form-edit-basic-details @update:session="afterUpdateSession"/> | ||
</div> | ||
<div class="col-xs-5"> | ||
<form-edit-password/> | ||
</div> | ||
</div> | ||
</page-body> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import FormEditBasicDetails from './edit/basic-details.vue'; | ||
import FormEditPassword from './edit/password.vue'; | ||
|
||
export default { | ||
name: 'AccountEdit', | ||
components: { FormEditBasicDetails, FormEditPassword }, | ||
data() { | ||
return { | ||
displayName: this.$session.user.displayName | ||
}; | ||
}, | ||
methods: { | ||
afterUpdateSession() { | ||
this.displayName = this.$session.user.displayName; | ||
this.$emit('update:session'); | ||
} | ||
} | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<!-- | ||
Copyright 2017 ODK Central Developers | ||
See the NOTICE file at the top-level directory of this distribution and at | ||
https://github.com/opendatakit/central-frontend/blob/master/NOTICE. | ||
|
||
This file is part of ODK Central. It is subject to the license terms in | ||
the LICENSE file found in the top-level directory of this distribution and at | ||
https://www.apache.org/licenses/LICENSE-2.0. No part of ODK Central, | ||
including this file, may be copied, modified, propagated, or distributed | ||
except according to the terms contained in the LICENSE file. | ||
--> | ||
<template> | ||
<div id="account-edit-basic-details" class="panel panel-simple"> | ||
<div class="panel-heading"><h1 class="panel-title">Basic Details</h1></div> | ||
<div class="panel-body"> | ||
<form @submit="submit"> | ||
<label class="form-group"> | ||
<input v-model.trim="email" type="email" class="form-control" | ||
placeholder="Email address *" required> | ||
<span class="form-label">Email address *</span> | ||
</label> | ||
<label class="form-group"> | ||
<input v-model.trim="displayName" type="text" class="form-control" | ||
placeholder="Display name *" required> | ||
<span class="form-label">Display name *</span> | ||
</label> | ||
<button :disabled="awaitingResponse" type="submit" | ||
class="btn btn-primary"> | ||
Update details <spinner :state="awaitingResponse"/> | ||
</button> | ||
</form> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import request from '../../../mixins/request'; | ||
import { logIn } from '../../../session'; | ||
|
||
export default { | ||
name: 'FormEditBasicDetails', | ||
mixins: [request()], | ||
data() { | ||
return { | ||
requestId: null, | ||
email: this.$session.user.email, | ||
displayName: this.$session.user.displayName | ||
}; | ||
}, | ||
methods: { | ||
submit() { | ||
const data = { email: this.email, displayName: this.displayName }; | ||
this.patch(`/users/${this.$session.user.id}`, data) | ||
.then(response => { | ||
const { token, expiresAt } = this.$session; | ||
logIn({ token, expiresAt }, response.data); | ||
this.$emit('update:session'); | ||
this.$alert().success('Success! Your user details have been updated.'); | ||
}) | ||
.catch(() => {}); | ||
} | ||
} | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<!-- | ||
Copyright 2017 ODK Central Developers | ||
See the NOTICE file at the top-level directory of this distribution and at | ||
https://github.com/opendatakit/central-frontend/blob/master/NOTICE. | ||
|
||
This file is part of ODK Central. It is subject to the license terms in | ||
the LICENSE file found in the top-level directory of this distribution and at | ||
https://www.apache.org/licenses/LICENSE-2.0. No part of ODK Central, | ||
including this file, may be copied, modified, propagated, or distributed | ||
except according to the terms contained in the LICENSE file. | ||
--> | ||
<template> | ||
<div id="account-edit-password" class="panel panel-simple"> | ||
<div class="panel-heading"> | ||
<h1 class="panel-title">Change Password</h1> | ||
</div> | ||
<div class="panel-body"> | ||
<form @submit="submit"> | ||
<label class="form-group"> | ||
<input id="form-edit-password-old-password" v-model="oldPassword" | ||
type="password" class="form-control" placeholder="Old password *" | ||
required> | ||
<span class="form-label">Old password *</span> | ||
</label> | ||
<label :class="{ 'has-error': mismatch }" class="form-group"> | ||
<input id="form-edit-password-new-password" v-model="newPassword" | ||
type="password" class="form-control" placeholder="New password *" | ||
required> | ||
<span class="form-label">New password *</span> | ||
</label> | ||
<label :class="{ 'has-error': mismatch }" class="form-group"> | ||
<input id="form-edit-password-confirm" v-model="confirm" | ||
type="password" class="form-control" | ||
placeholder="New password (confirm) *" required> | ||
<span class="form-label">New password (confirm) *</span> | ||
</label> | ||
<button :disabled="awaitingResponse" type="submit" | ||
class="btn btn-primary"> | ||
Change password <spinner :state="awaitingResponse"/> | ||
</button> | ||
</form> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import request from '../../../mixins/request'; | ||
|
||
export default { | ||
name: 'FormEditPassword', | ||
mixins: [request()], | ||
data() { | ||
return { | ||
requestId: null, | ||
oldPassword: '', | ||
newPassword: '', | ||
confirm: '', | ||
mismatch: false | ||
}; | ||
}, | ||
methods: { | ||
submit() { | ||
this.mismatch = this.newPassword !== this.confirm; | ||
if (this.mismatch) { | ||
this.$alert().danger('Please check that your new passwords match.'); | ||
return; | ||
} | ||
const data = { old: this.oldPassword, new: this.newPassword }; | ||
this.put(`/users/${this.$session.user.id}/password`, data) | ||
.then(() => { | ||
this.$alert().success('Success! Your password has been updated.'); | ||
}) | ||
.catch(() => {}); | ||
} | ||
} | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.