+ - Username
+
+ {{#if username}}
+ {{username}}
+ {{else}}
+ {{#if profile.name}}
+ {{profile.name}}
+ {{else}}
+ {{email}}
+ {{/if}}
+ {{/if}}
+
+
- Name
{{#if profile.name}}
{{profile.name}}
{{else}}
- {{email}}
+ {{username}}
{{/if}}
diff --git a/client/info_account_modal.js b/client/info_account_modal.js
index 0a1577b..ceb821c 100644
--- a/client/info_account_modal.js
+++ b/client/info_account_modal.js
@@ -28,11 +28,14 @@ Template.infoAccountModalInner.helpers({
pairs.push({key: 'Roles', value: 'None'});
for (var role in this.roles) {
- var r = this.roles[role];
- if (role === '0') {
- pairs.push({key: 'Roles', value: r});
- } else {
- pairs.push({key: '-', value: r});
+ if (this.roles.hasOwnProperty(role) ) {
+ // excludes any Array prototype extensions
+ var r = this.roles[role];
+ if (role === '0') {
+ pairs.push({key: 'Roles', value: r});
+ } else {
+ pairs.push({key: '-', value: r});
+ }
}
}
return pairs;
diff --git a/client/update_account_modal.html b/client/update_account_modal.html
index b8436db..284bc36 100644
--- a/client/update_account_modal.html
+++ b/client/update_account_modal.html
@@ -11,44 +11,48 @@
{{#with userInScope}}
-
-
+
+
{{#if roles}}
-
+
{{#each roles}}
- -
-
- {{this}}
-
+ -
+
+ {{this}}
+
{{/each}}
-
+
{{else}}
- This account has no roles.
+ This account has no roles.
{{/if}}
{{#if unsetRoles}}
-
-
-
-
+
+
+
+
{{else}}
-
All roles already set.
+
All roles already set.
{{/if}}
+
{{/with}}
diff --git a/client/update_account_modal.js b/client/update_account_modal.js
index 559fe0c..09382d4 100644
--- a/client/update_account_modal.js
+++ b/client/update_account_modal.js
@@ -7,7 +7,7 @@ Template.updateAccountModalInner.helpers({
//Iterate through services
for (var serviceName in this.services) {
var serviceObject = this.services[serviceName];
- //If an 'id' isset then assume valid service
+ //If an 'id' is set then assume valid service
if (serviceObject.id) {
if (serviceObject.email) {
return serviceObject.email;
@@ -76,10 +76,12 @@ Template.updateAccountModalInner.events({
Meteor.call('updateUserInfo', userId, ele.name, ele.value, function(error) {
if (error)
{
- if (typeof Errors === "undefined") Log.error('Error: ' + error.reason);
- else Errors.throw(error.reason);
+ Log.error('Error calling updateUserInfo: ' + error.error);
+ var me = $("div.modal.in .modal-header").append("")
+ $("div.alert",me).html(error.error)
return;
}
+ $("div.modal.in .modal-header div.alert").remove();
Session.set('userInScope', Meteor.users.findOne(userId));
});
}
diff --git a/libs/user_query.js b/libs/user_query.js
index a934433..fb3a131 100644
--- a/libs/user_query.js
+++ b/libs/user_query.js
@@ -10,6 +10,7 @@ filteredUserQuery = function(userId, filter) {
// TODO: passing to regex directly could be dangerous
users = Meteor.users.find({
$or: [
+ {'username': {$regex: filter, $options: 'i'}},
{'profile.name': {$regex: filter, $options: 'i'}},
{'emails.address': {$regex: filter, $options: 'i'}}
]
diff --git a/package.js b/package.js
index 493affd..e852125 100644
--- a/package.js
+++ b/package.js
@@ -1,6 +1,7 @@
Package.describe({
+ name: "accounts-admin",
summary: "A roles based account management system using bootstrap 3",
- version: "0.2.7",
+ version: "0.2.8",
git: "https://github.com/hharnisc/meteor-accounts-admin-ui-bootstrap-3.git"
});
@@ -28,4 +29,4 @@ Package.on_use(function (api, where) {
api.add_files('server/startup.js', 'server');
api.add_files('server/publish.js', 'server');
api.add_files('server/methods.js', 'server');
-});
+});
\ No newline at end of file
diff --git a/server/methods.js b/server/methods.js
index 165c4af..221aab6 100644
--- a/server/methods.js
+++ b/server/methods.js
@@ -75,7 +75,7 @@ Meteor.methods({
throw new Meteor.Error(422, 'Cannot delete role admin');
// remove the role from all users who currently have the role
- // if successfull remove the role
+ // if successful remove the role
Meteor.users.update(
{roles: role },
{$pull: {roles: role }},
@@ -95,9 +95,12 @@ Meteor.methods({
if (!user || !Roles.userIsInRole(user, ['admin']))
throw new Meteor.Error(401, "You need to be an admin to update a user.");
- if (property !== 'profile.name')
- throw new Meteor.Error(422, "Only 'name' is supported.");
-
+ if (['username','profile.name'].indexOf(property) === -1)
+ throw new Meteor.Error(422, "Programming error: Only 'username' or 'profile.name' is supported.");
+ if (property === 'username') {
+ if (Meteor.users.find({_id:{$ne:id},username:value}).count())
+ throw new Meteor.Error("username " + value + " already in use")
+ }
obj = {};
obj[property] = value;
Meteor.users.update({_id: id}, {$set: obj});
diff --git a/versions.json b/versions.json
index 152174a..93977bb 100644
--- a/versions.json
+++ b/versions.json
@@ -2,170 +2,218 @@
"dependencies": [
[
"accounts-base",
- "1.0.0"
+ "1.1.2"
],
[
"alanning:roles",
- "1.2.12"
+ "1.2.13"
],
[
"application-configuration",
- "1.0.0"
+ "1.0.3"
],
[
"autoupdate",
- "1.0.0"
+ "1.1.3"
+ ],
+ [
+ "base64",
+ "1.0.1"
],
[
"binary-heap",
- "1.0.0"
+ "1.0.1"
],
[
"blaze",
- "1.0.0"
+ "2.0.3"
],
[
"blaze-tools",
- "1.0.0"
+ "1.0.1"
+ ],
+ [
+ "boilerplate-generator",
+ "1.0.1"
],
[
"callback-hook",
- "1.0.0"
+ "1.0.1"
],
[
"check",
- "1.0.0"
+ "1.0.2"
+ ],
+ [
+ "ddp",
+ "1.0.12"
],
[
"deps",
- "1.0.0"
+ "1.0.5"
],
[
"ejson",
- "1.0.0"
+ "1.0.4"
+ ],
+ [
+ "fastclick",
+ "1.0.1"
],
[
"follower-livedata",
- "1.0.0"
+ "1.0.2"
],
[
"geojson-utils",
- "1.0.0"
+ "1.0.1"
],
[
"html-tools",
- "1.0.0"
+ "1.0.2"
],
[
"htmljs",
- "1.0.0-cordova1"
+ "1.0.2"
+ ],
+ [
+ "http",
+ "1.0.8"
],
[
"id-map",
- "1.0.0"
+ "1.0.1"
],
[
"jquery",
- "1.0.0"
+ "1.0.1"
],
[
"json",
+ "1.0.1"
+ ],
+ [
+ "launch-screen",
"1.0.0"
],
[
"livedata",
- "1.0.6"
+ "1.0.11"
],
[
"localstorage",
- "1.0.0"
+ "1.0.1"
],
[
"logging",
- "1.0.0"
+ "1.0.5"
],
[
"meteor",
- "1.0.2"
+ "1.1.3"
+ ],
+ [
+ "meteor-platform",
+ "1.2.0"
],
[
"minifiers",
- "1.0.0"
+ "1.1.2"
],
[
"minimongo",
- "1.0.0"
+ "1.0.5"
],
[
- "mongo-livedata",
- "1.0.0"
+ "mobile-status-bar",
+ "1.0.1"
+ ],
+ [
+ "mongo",
+ "1.0.9"
],
[
"observe-sequence",
- "1.0.0"
+ "1.0.3"
],
[
"ordered-dict",
- "1.0.0"
+ "1.0.1"
],
[
"random",
- "1.0.0"
+ "1.0.1"
],
[
"reactive-dict",
- "1.0.0"
+ "1.0.4"
+ ],
+ [
+ "reactive-var",
+ "1.0.3"
],
[
"reload",
- "1.0.0"
+ "1.1.1"
],
[
"retry",
- "1.0.0"
+ "1.0.1"
],
[
"routepolicy",
- "1.0.0-cordova1"
+ "1.0.2"
],
[
"service-configuration",
- "1.0.0"
+ "1.0.2"
],
[
"session",
- "1.0.0"
+ "1.0.4"
],
[
"spacebars",
- "1.0.0"
+ "1.0.3"
],
[
"spacebars-compiler",
- "1.0.0"
+ "1.0.3"
],
[
"standard-app-packages",
- "1.0.0"
+ "1.0.3"
],
[
"templating",
- "1.0.0"
+ "1.0.9"
+ ],
+ [
+ "tracker",
+ "1.0.3"
],
[
"ui",
- "1.0.0"
+ "1.0.4"
],
[
"underscore",
- "1.0.0"
+ "1.0.1"
+ ],
+ [
+ "url",
+ "1.0.2"
],
[
"webapp",
- "1.0.0"
+ "1.1.4"
+ ],
+ [
+ "webapp-hashing",
+ "1.0.1"
]
],
"pluginDependencies": [],
- "toolVersion": "meteor-tool@1.0.26",
+ "toolVersion": "meteor-tool@1.0.36",
"format": "1.0"
}
\ No newline at end of file