users: add api_token attribute, make editable in profile/account

pull/59/head^2
mntmn 2020-05-11 14:59:37 +02:00 committed by mntmn
parent 46769691d8
commit b93cc20371
4 changed files with 34 additions and 7 deletions

View File

@ -42,6 +42,7 @@ module.exports = {
avatar_thumb_uri: Sequelize.STRING, avatar_thumb_uri: Sequelize.STRING,
confirmation_token: Sequelize.STRING, confirmation_token: Sequelize.STRING,
password_reset_token: Sequelize.STRING, password_reset_token: Sequelize.STRING,
api_token: Sequelize.STRING,
home_folder_id: Sequelize.STRING, home_folder_id: Sequelize.STRING,
prefs_language: Sequelize.STRING, prefs_language: Sequelize.STRING,
prefs_email_notifications: Sequelize.STRING, prefs_email_notifications: Sequelize.STRING,

View File

@ -0,0 +1,19 @@
'use strict';
module.exports = {
up: function(migration, DataTypes) {
return Promise.all([
migration.addColumn('users', 'api_token',
{
type: DataTypes.STRING
}
)
])
},
down: function(migration, DataTypes) {
return Promise.all([
migration.removeColumn('users', 'api_token')
])
}
}

View File

@ -17,7 +17,6 @@ SpacedeckUsers = {
loading_user: false, loading_user: false,
password_reset_confirm_error: "", password_reset_confirm_error: "",
password_reset_error: "", password_reset_error: "",
}, },
methods:{ methods:{
load_user: function(on_success, on_error) { load_user: function(on_success, on_error) {

View File

@ -55,6 +55,15 @@
</div> </div>
<div> <div>
<div class="form-group">
<label class="label">API Token</label>
<input
type="text"
id="api-token"
class="input input-white no-b"
v-model="user.api_token"
placeholder="secret key">
</div>
<div class="form-group"> <div class="form-group">
<label class="label" >[[__("profile_name")]]</label> <label class="label" >[[__("profile_name")]]</label>
@ -67,18 +76,17 @@
<div class="form-group"> <div class="form-group">
<label class="label">[[__("profile_email")]]</label> <label class="label">[[__("profile_email")]]</label>
<input <input
id="new-email"
v-bind:class="{disabled: user.account_type=='google'}"
v-bind:disabled="user.account_type=='google'"
class="input input-white no-b"
type="email" type="email"
id="new-email"
class="input input-white no-b"
v-model="user.email" v-model="user.email"
v-on:change="user.email_changed=true" v-on:change="user.email_changed=true"
placeholder="mail@example.com"> placeholder="mail@example.com">
</div>
<button class="btn btn-md btn-dark" v-on:click=" save_user()" style="margin-top:20px">Save</button> <div class="form-group">
<button class="btn btn-md btn-dark" v-on:click="save_user()">Save</button>
</div> </div>
</div> </div>
</div> </div>