Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b99da301cd | ||
|
|
0a01885300 | ||
|
|
5cb1515235 | ||
|
|
7430c2c795 | ||
|
|
39f7548b8d | ||
|
|
c4a8c4b7ba | ||
|
|
263aba596c | ||
|
|
f98ed0b659 | ||
|
|
6159ce0e88 | ||
|
|
e9509a3a24 | ||
|
|
aa069fd885 |
@@ -20,3 +20,7 @@ mike:mocha
|
|||||||
dburles:mongo-collection-instances
|
dburles:mongo-collection-instances
|
||||||
percolate:migrations
|
percolate:migrations
|
||||||
ecwyne:mathjs
|
ecwyne:mathjs
|
||||||
|
useraccounts:polymer
|
||||||
|
accounts-google
|
||||||
|
splendido:accounts-meld
|
||||||
|
email
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
accounts-base@1.2.0
|
accounts-base@1.2.0
|
||||||
|
accounts-google@1.0.4
|
||||||
|
accounts-oauth@1.1.5
|
||||||
accounts-password@1.1.1
|
accounts-password@1.1.1
|
||||||
accounts-ui@1.1.5
|
accounts-ui@1.1.5
|
||||||
accounts-ui-unstyled@1.1.7
|
accounts-ui-unstyled@1.1.7
|
||||||
aldeed:collection2@2.3.3
|
aldeed:collection2@2.3.3
|
||||||
aldeed:simple-schema@1.3.2
|
aldeed:simple-schema@1.3.3
|
||||||
amplify@1.0.0
|
amplify@1.0.0
|
||||||
autoupdate@1.2.1
|
autoupdate@1.2.1
|
||||||
base64@1.0.3
|
base64@1.0.3
|
||||||
@@ -24,6 +26,7 @@ ejson@1.0.6
|
|||||||
email@1.0.6
|
email@1.0.6
|
||||||
fastclick@1.0.3
|
fastclick@1.0.3
|
||||||
geojson-utils@1.0.3
|
geojson-utils@1.0.3
|
||||||
|
google@1.1.5
|
||||||
html-tools@1.0.4
|
html-tools@1.0.4
|
||||||
htmljs@1.0.4
|
htmljs@1.0.4
|
||||||
http@1.1.0
|
http@1.1.0
|
||||||
@@ -44,20 +47,22 @@ less@1.0.14
|
|||||||
livedata@1.0.13
|
livedata@1.0.13
|
||||||
localstorage@1.0.3
|
localstorage@1.0.3
|
||||||
logging@1.0.7
|
logging@1.0.7
|
||||||
matb33:collection-hooks@0.7.11
|
matb33:collection-hooks@0.7.13
|
||||||
meteor@1.1.6
|
meteor@1.1.6
|
||||||
meteor-platform@1.2.2
|
meteor-platform@1.2.2
|
||||||
mike:mocha@0.5.3
|
mike:mocha@0.5.4
|
||||||
minifiers@1.1.5
|
minifiers@1.1.5
|
||||||
minimongo@1.0.8
|
minimongo@1.0.8
|
||||||
mobile-status-bar@1.0.3
|
mobile-status-bar@1.0.3
|
||||||
momentjs:moment@2.10.3
|
momentjs:moment@2.10.3
|
||||||
mongo@1.1.0
|
mongo@1.1.0
|
||||||
npm-bcrypt@0.7.8_2
|
npm-bcrypt@0.7.8_2
|
||||||
|
oauth@1.1.4
|
||||||
|
oauth2@1.1.3
|
||||||
observe-sequence@1.0.6
|
observe-sequence@1.0.6
|
||||||
ordered-dict@1.0.3
|
ordered-dict@1.0.3
|
||||||
package-version-parser@3.0.3
|
package-version-parser@3.0.3
|
||||||
percolate:migrations@0.7.3
|
percolate:migrations@0.7.5
|
||||||
practicalmeteor:chai@1.9.2_3
|
practicalmeteor:chai@1.9.2_3
|
||||||
practicalmeteor:loglevel@1.1.0_3
|
practicalmeteor:loglevel@1.1.0_3
|
||||||
random@1.0.3
|
random@1.0.3
|
||||||
@@ -72,16 +77,21 @@ sanjo:meteor-version@1.0.0
|
|||||||
service-configuration@1.0.4
|
service-configuration@1.0.4
|
||||||
session@1.1.0
|
session@1.1.0
|
||||||
sha@1.0.3
|
sha@1.0.3
|
||||||
|
softwarerero:accounts-t9n@1.0.9
|
||||||
spacebars@1.0.6
|
spacebars@1.0.6
|
||||||
spacebars-compiler@1.0.6
|
spacebars-compiler@1.0.6
|
||||||
|
splendido:accounts-emails-field@1.2.0
|
||||||
|
splendido:accounts-meld@1.3.0
|
||||||
srp@1.0.3
|
srp@1.0.3
|
||||||
templating@1.1.1
|
templating@1.1.1
|
||||||
tracker@1.0.7
|
tracker@1.0.7
|
||||||
ui@1.0.6
|
ui@1.0.6
|
||||||
underscore@1.0.3
|
underscore@1.0.3
|
||||||
url@1.0.4
|
url@1.0.4
|
||||||
|
useraccounts:core@1.9.1
|
||||||
|
useraccounts:polymer@1.9.1
|
||||||
velocity:chokidar@0.12.6_1
|
velocity:chokidar@0.12.6_1
|
||||||
velocity:core@0.6.0
|
velocity:core@0.6.1
|
||||||
velocity:html-reporter@0.5.3
|
velocity:html-reporter@0.5.3
|
||||||
velocity:meteor-internals@1.1.0_7
|
velocity:meteor-internals@1.1.0_7
|
||||||
velocity:shim@0.1.0
|
velocity:shim@0.1.0
|
||||||
|
|||||||
@@ -1,44 +1,23 @@
|
|||||||
Schema = {};
|
|
||||||
|
|
||||||
Schema.User = new SimpleSchema({
|
|
||||||
username: {
|
|
||||||
type: String,
|
|
||||||
regEx: /^[a-z0-9A-Z_]{3,15}$/,
|
|
||||||
optional: true,
|
|
||||||
},
|
|
||||||
emails: {
|
|
||||||
type: [Object],
|
|
||||||
// this must be optional if you also use other login services like facebook,
|
|
||||||
// but if you use only accounts-password, then it can be required
|
|
||||||
optional: true,
|
|
||||||
},
|
|
||||||
"emails.$.address": {
|
|
||||||
type: String,
|
|
||||||
regEx: SimpleSchema.RegEx.Email,
|
|
||||||
},
|
|
||||||
"emails.$.verified": {
|
|
||||||
type: Boolean
|
|
||||||
},
|
|
||||||
createdAt: {
|
|
||||||
type: Date
|
|
||||||
},
|
|
||||||
services: {
|
|
||||||
type: Object,
|
|
||||||
optional: true,
|
|
||||||
blackbox: true,
|
|
||||||
},
|
|
||||||
roles: {
|
|
||||||
type: [String],
|
|
||||||
optional: true,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
Meteor.users.attachSchema(Schema.User);
|
|
||||||
|
|
||||||
Meteor.users.allow({
|
Meteor.users.allow({
|
||||||
update: function(userId, doc, fields, modifier) {
|
update: function(userId, doc, fields, modifier) {
|
||||||
return userId === doc._id &&
|
if (
|
||||||
fields.length === 1 &&
|
doc._id === userId &&
|
||||||
fields[0] === "username";
|
_.contains(fields, "username") &&
|
||||||
|
_.contains(fields, "profile") &&
|
||||||
|
fields.length === 2 &&
|
||||||
|
_.keys(modifier).length === 1 &&
|
||||||
|
modifier.$set &&
|
||||||
|
modifier.$set["profile.username"] &&
|
||||||
|
modifier.$set.username &&
|
||||||
|
_.keys(modifier.$set).length === 2
|
||||||
|
){
|
||||||
|
var expectedUsername = modifier.$set["profile.username"];
|
||||||
|
expectedUsername = expectedUsername.toLowerCase().replace(/\s+/gm, "");
|
||||||
|
if (modifier.$set.username !== expectedUsername){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
var foundUser = Meteor.call("getUserId", expectedUsername);
|
||||||
|
return !foundUser || foundUser === userId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,6 +3,12 @@ Router.configure({
|
|||||||
layoutTemplate: "layout",
|
layoutTemplate: "layout",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Router.plugin("ensureSignedIn", {
|
||||||
|
except: ["home", "atSignIn", "atSignUp", "atForgotPassword", "notFound"]
|
||||||
|
});
|
||||||
|
|
||||||
|
Router.plugin("dataNotFound", {notFoundTemplate: "notFound"});
|
||||||
|
|
||||||
Router.map(function() {
|
Router.map(function() {
|
||||||
this.route("/", {
|
this.route("/", {
|
||||||
name: "home",
|
name: "home",
|
||||||
@@ -56,4 +62,8 @@ Router.map(function() {
|
|||||||
document.title = appName + " Account";
|
document.title = appName + " Account";
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.route("/loginButtons", {
|
||||||
|
name: "loginButtons",
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -85,19 +85,6 @@ Template.features.events({
|
|||||||
var featureId = this._id;
|
var featureId = this._id;
|
||||||
Features.update(featureId, {$set: {used: 0}});
|
Features.update(featureId, {$set: {used: 0}});
|
||||||
},
|
},
|
||||||
"tap #proficiencies": function(event){
|
|
||||||
var charId = this._id;
|
|
||||||
GlobalUI.setDetail({
|
|
||||||
template: "textDialog",
|
|
||||||
data: {
|
|
||||||
charId: charId,
|
|
||||||
field: "proficiencies",
|
|
||||||
title: "Proficiencies",
|
|
||||||
color: "q",
|
|
||||||
},
|
|
||||||
heroId: this._id + "proficiencies",
|
|
||||||
});
|
|
||||||
},
|
|
||||||
"tap .enabledCheckbox": function(event){
|
"tap .enabledCheckbox": function(event){
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template name="containerEdit">
|
<template name="containerEdit">
|
||||||
<paper-input id="containerNameInput fullwidth"
|
<paper-input id="containerNameInput"
|
||||||
label="Name"
|
label="Name"
|
||||||
floatinglabel
|
floatinglabel
|
||||||
value={{name}}></paper-input>
|
value={{name}}></paper-input>
|
||||||
|
|||||||
@@ -4,11 +4,7 @@ Template.containerDialog.helpers({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.containerEdit.onRendered(function(){
|
Template.containerDialog.events({
|
||||||
updatePolymerInputs(this);
|
|
||||||
});
|
|
||||||
|
|
||||||
Template.containerEdit.events({
|
|
||||||
"color-change": function(event, instance){
|
"color-change": function(event, instance){
|
||||||
Containers.update(instance.data.containerId, {$set: {color: event.color}});
|
Containers.update(instance.data.containerId, {$set: {color: event.color}});
|
||||||
},
|
},
|
||||||
@@ -20,8 +16,15 @@ Template.containerEdit.events({
|
|||||||
);
|
);
|
||||||
GlobalUI.closeDetail();
|
GlobalUI.closeDetail();
|
||||||
},
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.containerEdit.onRendered(function(){
|
||||||
|
updatePolymerInputs(this);
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.containerEdit.events({
|
||||||
//TODO validate input (integer, non-negative, etc) for these inputs and give validation errors
|
//TODO validate input (integer, non-negative, etc) for these inputs and give validation errors
|
||||||
"change #containerNameInput, input #containerNameInput": function(event){
|
"change #containerNameInput": function(event){
|
||||||
var name = Template.instance().find("#containerNameInput").value;
|
var name = Template.instance().find("#containerNameInput").value;
|
||||||
Containers.update(this._id, {$set: {name: name}});
|
Containers.update(this._id, {$set: {name: name}});
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template name="characterSideList">
|
<template name="characterSideList">
|
||||||
{{#if characters.count}}
|
|
||||||
<core-item icon="social:people" label="Characters"></core-item>
|
<core-item icon="social:people" label="Characters"></core-item>
|
||||||
|
{{#if characters.count}}
|
||||||
<div>
|
<div>
|
||||||
{{#each characters}}
|
{{#each characters}}
|
||||||
<div class="singleLineItem">{{name}}</div>
|
<div class="singleLineItem">{{name}}</div>
|
||||||
|
|||||||
7
rpg-docs/client/views/guide/guide.css
Normal file
7
rpg-docs/client/views/guide/guide.css
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
.wallOfText h2{
|
||||||
|
margin-top: 24px
|
||||||
|
}
|
||||||
|
|
||||||
|
.wallOfText p{
|
||||||
|
margin-top: 8px;
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
<template name="guide">
|
<template name="guide">
|
||||||
|
<div class="wallOfText">
|
||||||
<h1>Dicecloud Beta</h1>
|
<h1>Dicecloud Beta</h1>
|
||||||
<p>Welcome to the Dicecloud beta. Please don't share the link with people you don't actively play with, since the beta is intended to be small, and your experience will probably get laggy if it gets more traffic than I'm expecting.</p>
|
<p>Welcome to the Dicecloud beta. Please don't share the link with people you don't actively play with, since the beta is intended to be small, and your experience will probably get laggy if it gets more traffic than I'm expecting.</p>
|
||||||
<p>The beta is going to start with just the character sheet. You can play D&D without minis and maps, without a pre-written adventure, you can play without a lot of things, but the character sheet is necessary. So I'm starting here and working my way outwards.</p>
|
<p>The beta is going to start with just the character sheet. You can play D&D without minis and maps, without a pre-written adventure, you can play without a lot of things, but the character sheet is necessary. So I'm starting here and working my way outwards.</p>
|
||||||
@@ -10,7 +11,7 @@
|
|||||||
<p>You need to swim through a sunken section of dungeon to fetch the quest's Thing.<br>You'll need to take off your magical Plate Armor of +1 Constitution to swim without sinking, of course. Taking it off will change your armor class, your speed and your constitution, which in turn changes your hitpoints and your constitution saving throw. Working out all those changes in the middle of a game will drag the game to a hault. <br> Fortunately you have a digital character sheet, so it's a matter of dragging your Plate Armor +1 Con from your "equipment" box to your "backpack" box and you're done. Your hitpoints change correctly, your saving throws are up to date, your armor class goes back to reflecting the fact that you have natural armor from being a dragonborn. Your character sheet keeps up and you ultimately get more time to play the game. Huzzah!</p>
|
<p>You need to swim through a sunken section of dungeon to fetch the quest's Thing.<br>You'll need to take off your magical Plate Armor of +1 Constitution to swim without sinking, of course. Taking it off will change your armor class, your speed and your constitution, which in turn changes your hitpoints and your constitution saving throw. Working out all those changes in the middle of a game will drag the game to a hault. <br> Fortunately you have a digital character sheet, so it's a matter of dragging your Plate Armor +1 Con from your "equipment" box to your "backpack" box and you're done. Your hitpoints change correctly, your saving throws are up to date, your armor class goes back to reflecting the fact that you have natural armor from being a dragonborn. Your character sheet keeps up and you ultimately get more time to play the game. Huzzah!</p>
|
||||||
<h2>Creating a Character</h2>
|
<h2>Creating a Character</h2>
|
||||||
<ul>
|
<ul>
|
||||||
<li>In the <a href={{pathFor route="characterList"}}>character list</a>, click the plus button, floating in the bottom left corner.</li>
|
<li>In the <a href={{pathFor route="characterList"}}>character list</a>, click the plus button, floating in the bottom right corner.</li>
|
||||||
<li>Give your character a name, gender and race, these can be changed later if you change your mind. Then click the Add button</li>
|
<li>Give your character a name, gender and race, these can be changed later if you change your mind. Then click the Add button</li>
|
||||||
<li>Your new character should open, with most of its attributes and abilities at zero.</li>
|
<li>Your new character should open, with most of its attributes and abilities at zero.</li>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -40,7 +41,7 @@
|
|||||||
<p>Your character currently doesn't have any ability scores, so lets fix that. Whether you roll your abilities or point-buy them, lets add a feature to represent where they came from</p>
|
<p>Your character currently doesn't have any ability scores, so lets fix that. Whether you roll your abilities or point-buy them, lets add a feature to represent where they came from</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Navigate to the <emd>Features</emd> tab</li>
|
<li>Navigate to the <emd>Features</emd> tab</li>
|
||||||
<li>Click the plus button in the bottom left to add a new feature</li>
|
<li>Click the plus button in the bottom right to add a new feature</li>
|
||||||
<li>Give the Feature a name, like <em>Point Buy</em></li>
|
<li>Give the Feature a name, like <em>Point Buy</em></li>
|
||||||
<li>Leave the feature as always enabled, don't limit its uses, and leave the description blank</li>
|
<li>Leave the feature as always enabled, don't limit its uses, and leave the description blank</li>
|
||||||
<li>Click the <em>Add Effect</em> button</li>
|
<li>Click the <em>Add Effect</em> button</li>
|
||||||
@@ -87,4 +88,5 @@
|
|||||||
<li>Change your level and check that the <em>Stats</em> tab gets updated accordingly</li>
|
<li>Change your level and check that the <em>Stats</em> tab gets updated accordingly</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p>You can try all sorts of calculations in your effects and in certain other places too. For example if you had some feature that is used a number of times equal to your wisdom modifier or 1, whichever is lower, you could limit its uses to <em>min(1, wisdomMod)</em> and the character sheet will figure it out for you, and update itself if you wisdom modifier happens to change later.</p>
|
<p>You can try all sorts of calculations in your effects and in certain other places too. For example if you had some feature that is used a number of times equal to your wisdom modifier or 1, whichever is lower, you could limit its uses to <em>min(1, wisdomMod)</em> and the character sheet will figure it out for you, and update itself if you wisdom modifier happens to change later.</p>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
<template name="layout">
|
<template name="layout">
|
||||||
|
|
||||||
<core-drawer-panel>
|
<core-drawer-panel>
|
||||||
<core-header-panel drawer navigation flex mode="seamed" class="white">
|
<core-header-panel drawer navigation flex mode="seamed" class="white">
|
||||||
<div id="accountSummary">
|
<div id="accountSummary">
|
||||||
{{> loginButtons}}
|
|
||||||
{{#if currentUser}}
|
{{#if currentUser}}
|
||||||
<div id="profileLink" style="text-decoration: underline; cursor: pointer;">
|
<div id="profileLink" style="text-decoration: underline; cursor: pointer;">
|
||||||
My account
|
{{profileLink}}
|
||||||
</div>
|
</div>
|
||||||
|
{{else}}
|
||||||
|
<a href="/sign-in" style="color: white;">Sign in</a>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
<div id="navPanel">
|
<div id="navPanel">
|
||||||
|
|||||||
@@ -9,7 +9,11 @@ Template.layout.destroyed = function() {
|
|||||||
Template.layout.helpers({
|
Template.layout.helpers({
|
||||||
notSelected: function(){
|
notSelected: function(){
|
||||||
return Session.get("global.ui.detailShow") ? "not-selected" : null;
|
return Session.get("global.ui.detailShow") ? "not-selected" : null;
|
||||||
}
|
},
|
||||||
|
profileLink: function() {
|
||||||
|
var user = Meteor.user();
|
||||||
|
return user.profile && user.profile.username || user.username || "My Account";
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.layout.events({
|
Template.layout.events({
|
||||||
|
|||||||
11
rpg-docs/client/views/notFound/notFound.html
Normal file
11
rpg-docs/client/views/notFound/notFound.html
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<template name="notFound">
|
||||||
|
<div layout vertical center center-justified fit>
|
||||||
|
<h2>The data for the page you requested could not be found.</h2>
|
||||||
|
{{#if currentUser}}
|
||||||
|
<h2>It might not exist, or you might not have permission to view it.</h2>
|
||||||
|
{{else}}
|
||||||
|
<h2>Perhaps you need to sign in first:</h2>
|
||||||
|
{{atForm}}
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -3,11 +3,7 @@
|
|||||||
<core-toolbar class="blue-grey white-text">
|
<core-toolbar class="blue-grey white-text">
|
||||||
<core-icon-button icon="menu" core-drawer-toggle></core-icon-button>
|
<core-icon-button icon="menu" core-drawer-toggle></core-icon-button>
|
||||||
<div id="username" class="clickable" flex>
|
<div id="username" class="clickable" flex>
|
||||||
{{#if username}}
|
{{profileName}}
|
||||||
{{username}}
|
|
||||||
{{else}}
|
|
||||||
Tap to set username
|
|
||||||
{{/if}}
|
|
||||||
</div>
|
</div>
|
||||||
</core-toolbar>
|
</core-toolbar>
|
||||||
<div id="userProfile" class="padded">
|
<div id="userProfile" class="padded">
|
||||||
@@ -20,5 +16,7 @@
|
|||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{{> atForm}}
|
||||||
|
{{> atNavButton }}
|
||||||
{{/with}}
|
{{/with}}
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,3 +1,12 @@
|
|||||||
|
Template.profile.helpers({
|
||||||
|
profileName: function() {
|
||||||
|
var user = Meteor.user();
|
||||||
|
return user.profile && user.profile.username ||
|
||||||
|
user.username ||
|
||||||
|
"Tap to set username";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
Template.profile.events({
|
Template.profile.events({
|
||||||
"tap #username": function(){
|
"tap #username": function(){
|
||||||
if (this._id === Meteor.userId()){
|
if (this._id === Meteor.userId()){
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
<template name="usernameDialog">
|
<template name="usernameDialog">
|
||||||
{{#with currentUser}}
|
|
||||||
<div>
|
<div>
|
||||||
<paper-input id="usernameInput" label="Username" value={{username}}></paper-input>
|
<paper-input id="usernameInput" label="Username" value={{profileName}}></paper-input>
|
||||||
</div>
|
</div>
|
||||||
{{/with}}
|
<div style="color: red;" class="vertMargin">{{errorMessage}}</div>
|
||||||
<paper-button id="cancelButton" affirmative> Cancel </paper-button>
|
<paper-button id="cancelButton" affirmative> Cancel </paper-button>
|
||||||
<paper-button id="changeButton" affirmative> Change Username </paper-button>
|
<paper-button id="changeButton" disabled={{invalid}} affirmative> Change Username </paper-button>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,8 +1,49 @@
|
|||||||
|
var getUsername = function() {
|
||||||
|
var user = Meteor.user();
|
||||||
|
return user.profile && user.profile.username || user.username;
|
||||||
|
};
|
||||||
|
|
||||||
|
Template.usernameDialog.onCreated(function() {
|
||||||
|
this.errorMessage = new ReactiveVar("");
|
||||||
|
this.username = new ReactiveVar(getUsername());
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.usernameDialog.helpers({
|
||||||
|
profileName: function() {
|
||||||
|
return getUsername();
|
||||||
|
},
|
||||||
|
invalid: function() {
|
||||||
|
return !!Template.instance().errorMessage.get();
|
||||||
|
},
|
||||||
|
errorMessage: function() {
|
||||||
|
return Template.instance().errorMessage.get();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
Template.usernameDialog.events({
|
Template.usernameDialog.events({
|
||||||
|
"change #usernameInput, input #usernameInput": function(event, instance) {
|
||||||
|
var username = instance.find("#usernameInput").value;
|
||||||
|
username = username.trim().toLowerCase().replace(/\s+/gm, "");
|
||||||
|
if (username.length < 3){
|
||||||
|
instance.errorMessage.set("Username too short");
|
||||||
|
} else {
|
||||||
|
instance.errorMessage.set("Validating...");
|
||||||
|
Meteor.call("getUserId", username, function(err, userId){
|
||||||
|
if (userId && userId !== Meteor.userId())
|
||||||
|
instance.errorMessage.set("This username is taken");
|
||||||
|
else
|
||||||
|
instance.errorMessage.set("");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
"tap #changeButton": function(event, instance){
|
"tap #changeButton": function(event, instance){
|
||||||
|
var username = instance.find("#usernameInput").value;
|
||||||
|
username = username.trim().replace(/\s+/gm, " ");
|
||||||
|
var profileName = username;
|
||||||
|
username = username.toLowerCase().replace(/\s+/gm, "");
|
||||||
Meteor.users.update(
|
Meteor.users.update(
|
||||||
Meteor.userId(),
|
Meteor.userId(),
|
||||||
{$set: {username: instance.find("#usernameInput").value}}
|
{$set: {username: username, "profile.username": profileName}}
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
13
rpg-docs/client/views/user/titledAtForm/titledAtForm.html
Normal file
13
rpg-docs/client/views/user/titledAtForm/titledAtForm.html
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<template name="titledAtForm">
|
||||||
|
<core-toolbar class="blue-grey white-text">
|
||||||
|
<core-icon-button icon="menu" core-drawer-toggle></core-icon-button>
|
||||||
|
<div flex>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</core-toolbar>
|
||||||
|
<div class="scroll-y padded" fit layout vertical center center-justified>
|
||||||
|
<paper-shadow class="white" style="max-width: 400px;">
|
||||||
|
{{> atForm}}
|
||||||
|
</paper-shadow>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
71
rpg-docs/lib/constants/useraccountsConfig.js
Normal file
71
rpg-docs/lib/constants/useraccountsConfig.js
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
AccountsTemplates.configure({
|
||||||
|
//behaviour
|
||||||
|
confirmPassword: true,
|
||||||
|
enablePasswordChange: true,
|
||||||
|
enforceEmailVerification: true,
|
||||||
|
overrideLoginErrors: false,
|
||||||
|
sendVerificationEmail: true,
|
||||||
|
lowercaseUsername: true,
|
||||||
|
//appearance
|
||||||
|
continuousValidation: true,
|
||||||
|
negativeValidation: true,
|
||||||
|
negativeFeedback: true,
|
||||||
|
showValidating: true,
|
||||||
|
showAddRemoveServices: true,
|
||||||
|
showForgotPasswordLink: true,
|
||||||
|
showResendVerificationEmailLink: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
AccountsTemplates.configureRoute("changePwd", {
|
||||||
|
template: "titledAtForm",
|
||||||
|
});
|
||||||
|
AccountsTemplates.configureRoute("enrollAccount", {
|
||||||
|
template: "titledAtForm",
|
||||||
|
});
|
||||||
|
AccountsTemplates.configureRoute("forgotPwd", {
|
||||||
|
template: "titledAtForm",
|
||||||
|
});
|
||||||
|
AccountsTemplates.configureRoute("resetPwd", {
|
||||||
|
template: "titledAtForm",
|
||||||
|
});
|
||||||
|
AccountsTemplates.configureRoute("signIn", {
|
||||||
|
template: "titledAtForm",
|
||||||
|
});
|
||||||
|
AccountsTemplates.configureRoute("signUp", {
|
||||||
|
template: "titledAtForm",
|
||||||
|
});
|
||||||
|
AccountsTemplates.configureRoute("verifyEmail", {
|
||||||
|
template: "titledAtForm",
|
||||||
|
});
|
||||||
|
AccountsTemplates.configureRoute("resendVerificationEmail", {
|
||||||
|
template: "titledAtForm",
|
||||||
|
});
|
||||||
|
|
||||||
|
if (Meteor.isServer){
|
||||||
|
Meteor.methods({
|
||||||
|
"userExists": function(username){
|
||||||
|
return !!Meteor.users.findOne({username: username});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
AccountsTemplates.addField({
|
||||||
|
_id: "username",
|
||||||
|
type: "text",
|
||||||
|
required: true,
|
||||||
|
func: function(value){
|
||||||
|
if (Meteor.isClient) {
|
||||||
|
var self = this;
|
||||||
|
Meteor.call("userExists", value, function(err, userExists){
|
||||||
|
if (!userExists)
|
||||||
|
self.setSuccess();
|
||||||
|
else
|
||||||
|
self.setError("This username is taken");
|
||||||
|
self.setValidating(false);
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Server
|
||||||
|
return Meteor.call("userExists", value);
|
||||||
|
},
|
||||||
|
});
|
||||||
@@ -9,23 +9,27 @@ evaluate = function(charId, string){
|
|||||||
}
|
}
|
||||||
//ability modifiers
|
//ability modifiers
|
||||||
var abilityMods = [
|
var abilityMods = [
|
||||||
"STRENGTHMOD",
|
"strengthMod",
|
||||||
"DEXTERITYMOD",
|
"dexterityMod",
|
||||||
"CONSTITUTIONMOD",
|
"constitutionMod",
|
||||||
"INTELLIGENCEMOD",
|
"intelligenceMod",
|
||||||
"WISDOMMOD",
|
"wisdomMod",
|
||||||
"CHARISMAMOD",
|
"charismaMod",
|
||||||
];
|
];
|
||||||
if (_.contains(abilityMods, sub.toUpperCase())){
|
if (_.contains(abilityMods, sub)){
|
||||||
var slice = sub.slice(0, -3);
|
var slice = sub.slice(0, -3);
|
||||||
|
try {
|
||||||
return char.abilityMod(slice);
|
return char.abilityMod(slice);
|
||||||
|
} catch (e){
|
||||||
|
return sub;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//class levels
|
//class levels
|
||||||
if (/\w+levels?\b/gi.test(sub)){
|
if (/\w+levels?\b/gi.test(sub)){
|
||||||
//strip out "level"
|
//strip out "level"
|
||||||
var className = sub.replace(/levels?\b/gi, "");
|
var className = sub.replace(/levels?\b/gi, "");
|
||||||
var cls = Classes.findOne({charId: charId, name: className});
|
var cls = Classes.findOne({charId: charId, name: className});
|
||||||
return cls && cls.level;
|
return cls && cls.level || sub;
|
||||||
}
|
}
|
||||||
//character level
|
//character level
|
||||||
if (sub.toUpperCase() === "LEVEL"){
|
if (sub.toUpperCase() === "LEVEL"){
|
||||||
|
|||||||
27
rpg-docs/server/lib/configuration/accountsMeldConfig.js
Normal file
27
rpg-docs/server/lib/configuration/accountsMeldConfig.js
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
AccountsMeld.configure({
|
||||||
|
meldDBCallback: function(sourceUserId, destinationUserId){
|
||||||
|
// Here you can modify every collection you need for the document referencing
|
||||||
|
// to sourceUserId to be modified in order to point to destinationUserId
|
||||||
|
Characters.update(
|
||||||
|
{owner: sourceUserId},
|
||||||
|
{$set: {owner: destinationUserId}},
|
||||||
|
{multi: true}
|
||||||
|
);
|
||||||
|
Characters.update(
|
||||||
|
{writers: sourceUserId},
|
||||||
|
{
|
||||||
|
$pull: {writers: sourceUserId},
|
||||||
|
$addToSet: {writers: destinationUserId},
|
||||||
|
},
|
||||||
|
{multi: true}
|
||||||
|
);
|
||||||
|
Characters.update(
|
||||||
|
{readers: sourceUserId},
|
||||||
|
{
|
||||||
|
$pull: {readers: sourceUserId},
|
||||||
|
$addToSet: {readers: destinationUserId},
|
||||||
|
},
|
||||||
|
{multi: true}
|
||||||
|
);
|
||||||
|
},
|
||||||
|
});
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
Meteor.publish("singleCharacter", function(characterId, userId){
|
Meteor.publish("singleCharacter", function(characterId){
|
||||||
|
userId = this.userId;
|
||||||
|
if (!userId) return [];
|
||||||
var char = Characters.findOne({
|
var char = Characters.findOne({
|
||||||
_id: characterId,
|
_id: characterId,
|
||||||
$or: [
|
$or: [
|
||||||
@@ -29,5 +31,7 @@ Meteor.publish("singleCharacter", function(characterId, userId){
|
|||||||
{fields: {username: 1}}
|
{fields: {username: 1}}
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
} else {
|
||||||
|
return [];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user