mirror of
https://github.com/wekan/wekan.git
synced 2026-02-14 04:04:21 +01:00
Work on the user account system
Allow a user to modifies its name, username, initials, and password. Fixes username handling on sandstorm. Fixes #149.
This commit is contained in:
parent
5f09c0ce40
commit
7f6929608c
34 changed files with 255 additions and 164 deletions
|
|
@ -1,5 +1,5 @@
|
|||
_.each(['signIn', 'signUp', 'resetPwd',
|
||||
'forgotPwd', 'enrollAccount', 'changePwd'], function(routeName) {
|
||||
_.each(['signIn', 'signUp', 'resetPwd', 'forgotPwd', 'enrollAccount'],
|
||||
function(routeName) {
|
||||
AccountsTemplates.configureRoute(routeName, {
|
||||
layoutTemplate: 'userFormsLayout'
|
||||
});
|
||||
|
|
@ -20,9 +20,3 @@ Router.route('/profile/:username', {
|
|||
};
|
||||
}
|
||||
});
|
||||
|
||||
Router.route('/settings', {
|
||||
name: 'Settings',
|
||||
template: 'settings',
|
||||
layoutTemplate: 'AuthLayout'
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,49 +1,50 @@
|
|||
.at-form-landing-logo
|
||||
width: 275px
|
||||
margin: auto
|
||||
margin-top: 50px
|
||||
margin-top: 17vh
|
||||
|
||||
img
|
||||
.auth-layout
|
||||
.at-form-landing-logo
|
||||
width: 275px
|
||||
margin: auto
|
||||
margin-top: 50px
|
||||
margin-top: 17vh
|
||||
|
||||
.at-form
|
||||
margin: auto
|
||||
width: 275px
|
||||
padding: 25px
|
||||
margin-top: 20px
|
||||
padding-bottom: 10px
|
||||
background: #fff
|
||||
border-radius: 3px
|
||||
border: 1px solid #dbdbdb
|
||||
border-bottom-color: #c2c2c2
|
||||
box-shadow: 0 1px 6px rgba(0, 0, 0, .3)
|
||||
img
|
||||
width: 275px
|
||||
|
||||
.at-link
|
||||
color: darken(#27AE60, 40%)
|
||||
.at-form
|
||||
margin: auto
|
||||
width: 275px
|
||||
padding: 25px
|
||||
margin-top: 20px
|
||||
padding-bottom: 10px
|
||||
background: #fff
|
||||
border-radius: 3px
|
||||
border: 1px solid #dbdbdb
|
||||
border-bottom-color: #c2c2c2
|
||||
box-shadow: 0 1px 6px rgba(0, 0, 0, .3)
|
||||
|
||||
label
|
||||
margin-bottom: 3px
|
||||
.at-link
|
||||
color: darken(#27AE60, 40%)
|
||||
|
||||
input
|
||||
width: 100%
|
||||
label
|
||||
margin-bottom: 3px
|
||||
|
||||
.at-title
|
||||
background: #F7F7F7
|
||||
margin: -25px
|
||||
padding: 15px 25px 5px
|
||||
margin-bottom: 20px
|
||||
border-bottom: 1px solid #dcdcdc
|
||||
color: darken(white, 70%)
|
||||
font-weight: bold
|
||||
input
|
||||
width: 100%
|
||||
|
||||
.at-signup-link,
|
||||
.at-signin-link,
|
||||
.at-forgotPwd
|
||||
font-size: 0.9em
|
||||
margin-top: 15px
|
||||
color: darken(white, 70%)
|
||||
|
||||
.at-signUp,
|
||||
.at-signIn
|
||||
.at-title
|
||||
background: #F7F7F7
|
||||
margin: -25px
|
||||
padding: 15px 25px 5px
|
||||
margin-bottom: 20px
|
||||
border-bottom: 1px solid #dcdcdc
|
||||
color: darken(white, 70%)
|
||||
font-weight: bold
|
||||
|
||||
.at-signup-link,
|
||||
.at-signin-link,
|
||||
.at-forgotPwd
|
||||
font-size: 0.9em
|
||||
margin-top: 15px
|
||||
color: darken(white, 70%)
|
||||
|
||||
.at-signUp,
|
||||
.at-signIn
|
||||
font-weight: bold
|
||||
|
|
|
|||
|
|
@ -1,23 +1,44 @@
|
|||
template(name="headerUserBar")
|
||||
a#header-user-bar.js-open-header-member-menu
|
||||
.header-user-bar-name
|
||||
a#header-user-bar
|
||||
.header-user-bar-name.js-open-header-member-menu
|
||||
i.fa.fa-chevron-down
|
||||
if currentUser.profile.name
|
||||
= currentUser.profile.name
|
||||
else
|
||||
= currentUser.username
|
||||
+userAvatar(user=currentUser)
|
||||
.header-user-bar-avatar.js-change-avatar
|
||||
+userAvatar(user=currentUser)
|
||||
|
||||
template(name="memberMenuPopup")
|
||||
ul.pop-over-list
|
||||
li: a(href="{{pathFor route='Profile' username=currentUser.username}}") {{_ 'profile'}}
|
||||
li: a.js-language {{_ 'language'}}
|
||||
li: a(href = "{{pathFor route='Settings'}}") {{_ 'settings'}}
|
||||
with currentUser
|
||||
li: a.js-edit-profile Edit Profile…
|
||||
li: a.js-change-avatar Change Avatar…
|
||||
li: a.js-change-password Change Password…
|
||||
li: a.js-change-language Change Language…
|
||||
hr
|
||||
ul.pop-over-list
|
||||
li: a.js-logout {{_ 'log-out'}}
|
||||
|
||||
template(name="setLanguagePopup")
|
||||
template(name="editProfilePopup")
|
||||
form
|
||||
label
|
||||
| {{_ "fullname"}}
|
||||
input.js-profile-fullname(type="text" value=profile.name autofocus)
|
||||
label
|
||||
| {{_ "username"}}
|
||||
input.js-profile-username(type="text" value=username)
|
||||
label
|
||||
| Initials
|
||||
input.js-profile-initials(type="text" value=profile.initials)
|
||||
input.primary.wide(type="submit" value="{{_ 'save'}}")
|
||||
|
||||
template(name="changeAvatarPopup")
|
||||
|
||||
template(name="changePasswordPopup")
|
||||
+atForm(state='changePwd')
|
||||
|
||||
template(name="changeLanguagePopup")
|
||||
ul.pop-over-list
|
||||
each languages
|
||||
li(class="{{# if isCurrentLanguage}}active{{/if}}")
|
||||
|
|
|
|||
|
|
@ -1,8 +1,64 @@
|
|||
Template.headerUserBar.events({
|
||||
'click .js-open-header-member-menu': Popup.open('memberMenu')
|
||||
'click .js-open-header-member-menu': Popup.open('memberMenu'),
|
||||
'click .js-change-avatar': Popup.open('changeAvatar')
|
||||
});
|
||||
|
||||
Template.setLanguagePopup.helpers({
|
||||
Template.memberMenuPopup.events({
|
||||
'click .js-edit-profile': Popup.open('editProfile'),
|
||||
'click .js-change-avatar': Popup.open('changeAvatar'),
|
||||
'click .js-change-password': Popup.open('changePassword'),
|
||||
'click .js-change-language': Popup.open('changeLanguage'),
|
||||
'click .js-logout': function(evt) {
|
||||
evt.preventDefault();
|
||||
|
||||
AccountsTemplates.logout();
|
||||
}
|
||||
});
|
||||
|
||||
Template.editProfilePopup.events({
|
||||
submit: function(evt, tpl) {
|
||||
evt.preventDefault();
|
||||
var fullname = $.trim(tpl.find('.js-profile-fullname').value);
|
||||
var username = $.trim(tpl.find('.js-profile-username').value);
|
||||
var initials = $.trim(tpl.find('.js-profile-initials').value);
|
||||
Users.update(Meteor.userId(), {$set: {
|
||||
'profile.fullname': fullname,
|
||||
'profile.initials': initials
|
||||
}});
|
||||
// XXX We should report the error to the user.
|
||||
if (username !== Meteor.user().username) {
|
||||
Meteor.call('setUsername', username);
|
||||
}
|
||||
Popup.back();
|
||||
}
|
||||
});
|
||||
|
||||
// We display the form to change the password in a popup window that already
|
||||
// have a title, so we unset the title automatically displayed by useraccounts.
|
||||
AccountsTemplates.configure({
|
||||
texts: {
|
||||
title: {
|
||||
changePwd: ''
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
AccountsTemplates.configureRoute('changePwd', {
|
||||
redirect: function() {
|
||||
// XXX We should emit a notification once we have a notification system.
|
||||
// Currently the user has no indication that his modification has been
|
||||
// applied.
|
||||
Popup.back();
|
||||
}
|
||||
});
|
||||
|
||||
// XXX For some reason the useraccounts autofocus isnt working in this case.
|
||||
// See https://github.com/meteor-useraccounts/core/issues/384
|
||||
Template.changePasswordPopup.onRendered(function() {
|
||||
this.find('#at-field-current_password').focus();
|
||||
});
|
||||
|
||||
Template.changeLanguagePopup.helpers({
|
||||
languages: function() {
|
||||
return _.map(TAPi18n.getLanguages(), function(lang, tag) {
|
||||
return {
|
||||
|
|
@ -16,18 +72,7 @@ Template.setLanguagePopup.helpers({
|
|||
}
|
||||
});
|
||||
|
||||
Template.memberMenuPopup.events({
|
||||
'click .js-language': Popup.open('setLanguage'),
|
||||
'click .js-logout': function(evt) {
|
||||
evt.preventDefault();
|
||||
|
||||
Meteor.logout(function() {
|
||||
Router.go('Home');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Template.setLanguagePopup.events({
|
||||
Template.changeLanguagePopup.events({
|
||||
'click .js-set-language': function(evt) {
|
||||
Users.update(Meteor.userId(), {
|
||||
$set: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue