diff --git a/models/db.js b/models/db.js index b5fb3a8b1e2e7cf5bd560be2008419de89894092..a0d29502b4f7898237046908671436cef090aba4 100644 --- a/models/db.js +++ b/models/db.js @@ -42,6 +42,7 @@ module.exports = { avatar_thumb_uri: Sequelize.STRING, confirmation_token: Sequelize.STRING, password_reset_token: Sequelize.STRING, + api_token: Sequelize.STRING, home_folder_id: Sequelize.STRING, prefs_language: Sequelize.STRING, prefs_email_notifications: Sequelize.STRING, diff --git a/models/migrations/02-users-add-api-token.js b/models/migrations/02-users-add-api-token.js new file mode 100644 index 0000000000000000000000000000000000000000..ca8d67f706f8092e0153c6c88fb0574c88c234c0 --- /dev/null +++ b/models/migrations/02-users-add-api-token.js @@ -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') + ]) + } +} diff --git a/public/javascripts/spacedeck_users.js b/public/javascripts/spacedeck_users.js index 7f2a9ad9398b8a1e923f6774db1723513238f148..3efa13a3ef50754f1a19c2eab2563687b290a264 100644 --- a/public/javascripts/spacedeck_users.js +++ b/public/javascripts/spacedeck_users.js @@ -17,7 +17,6 @@ SpacedeckUsers = { loading_user: false, password_reset_confirm_error: "", password_reset_error: "", - }, methods:{ load_user: function(on_success, on_error) { diff --git a/views/partials/account.html b/views/partials/account.html index 5f94649f93732666625faab40eab32dd0989aca7..450196b23be50a2913cf27f6b0beb6f4c752e2d4 100644 --- a/views/partials/account.html +++ b/views/partials/account.html @@ -55,6 +55,15 @@ </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"> <label class="label" >[[__("profile_name")]]</label> @@ -67,18 +76,17 @@ <div class="form-group"> <label class="label">[[__("profile_email")]]</label> - <input + type="email" 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" v-model="user.email" v-on:change="user.email_changed=true" 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>