Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for #221 and #229 #240

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/views/signIn/signIn.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ AccountsEntry.entrySignInHelpers = {
if AccountsEntry.settings.passwordSignupFields is 'EMAIL_ONLY'
'email'
else
'string'
'text'

emailPlaceholder: ->
fields = AccountsEntry.settings.passwordSignupFields
Expand Down
2 changes: 1 addition & 1 deletion client/views/signIn/signIn.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ <h3>{{t9n "signIn"}}</h3>
</div>
{{#unless isUsernameOnly}}
<p><a href="{{pathFor 'entryForgotPassword'}}">{{t9n "forgotPassword"}}</a></p>
<button type="submit" class="submit btn btn-block btn-default">{{t9n "signIn"}}</button>
{{/unless}}
<button type="submit" class="submit btn btn-block btn-default">{{t9n "signIn"}}</button>
</form>
{{/if}}
{{#if showCreateAccountLink}}
Expand Down
10 changes: 5 additions & 5 deletions client/views/signUp/signUp.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ <h3>{{t9n "createAccount"}}</h3>
{{/each}}
{{#if passwordLoginService}}
<div class="email-option">
<strong class="line-thru">OR</strong>
<strong class="line-thru">{{t9n "OR"}}</strong>
<a data-toggle="collapse" href="#signUp">
{{t9n "signUpWithYourEmailAddress"}}
</a>
Expand All @@ -32,24 +32,24 @@ <h3>{{t9n "createAccount"}}</h3>
{{#if showUsername}}
<div class="form-group">
<label>{{t9n "username"}}</label>
<input autofocus name="username" type="string" class="form-control" value=''>
<input autofocus name="username" type="text" class="form-control" value='' placeholder="{{t9n 'username'}}">
</div>
{{/if}}

{{#if showEmail}}
<div class="form-group">
<label>{{t9n "emailAddress"}}</label>
{{#if showUsername}}
<input type="email" class="form-control" value='{{emailAddress}}'>
<input type="email" class="form-control" value='{{emailAddress}}' placeholder="{{t9n 'email'}}">
{{else}}
<input autofocus type="email" class="form-control" value='{{emailAddress}}'>
<input autofocus type="email" class="form-control" value='{{emailAddress}}' placeholder="{{t9n 'email'}}">
{{/if}}
</div>
{{/if}}

<div class="form-group">
<label>{{t9n "password"}}</label>
<input type="password" class="form-control" value=''>
<input type="password" class="form-control" value='' placeholder="{{t9n 'password'}}">
</div>

{{#if showSignupCode}}
Expand Down
30 changes: 17 additions & 13 deletions package.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
Package.describe({
summary: "Make signin and signout their own pages with routes."
summary: "Make signin and signout their own pages with routes.",
version: '0.9.1',
git: 'https://github.com/nunohvidal/accounts-entry'
});

Package.on_use(function(api) {
Package.onUse(function(api) {
api.versionsFrom("[email protected]");

api.use(['iron:router', 'mrt:accounts-t9n'], ['client', 'server']);
// CLIENT
api.use([
'deps',
Expand All @@ -14,13 +18,13 @@ Package.on_use(function(api) {
'handlebars',
'session',
'coffeescript',
'simple-form',
'joshowens:simple-form',
'less',
'sha']
, 'client');


api.add_files([
api.addFiles([
'client/entry.coffee',
'client/entry.less',
'client/helpers.coffee',
Expand Down Expand Up @@ -65,29 +69,29 @@ Package.on_use(function(api) {
'coffeescript'
], 'server');

api.add_files(['server/entry.coffee'], 'server');
api.addFiles(['server/entry.coffee'], 'server');

// CLIENT and SERVER
api.imply('accounts-base', ['client', 'server']);
api.imply('accounts-password', ['client', 'server']);
api.export('AccountsEntry', ['client', 'server']);
api.use('iron-router', ['client', 'server']);
api.use(['accounts-t9n'], ['client', 'server']);
api.add_files(['shared/router.coffee'], ['client', 'server']);
api.use('iron:router', ['client', 'server']);
api.use(['mrt:accounts-t9n'], ['client', 'server']);
api.addFiles(['shared/router.coffee'], ['client', 'server']);

});

Package.on_test(function (api) {
Package.onTest(function (api) {
api.use(['tinytest',
'underscore',
'handlebars',
'test-helpers',
'templating',
'mongo-livedata',
'coffeescript',
'simple-form',
'iron-router']);
api.use('accounts-entry');
'joshownens:simple-form',
'iron:router']);
api.use('mrt:accounts-entry');

api.add_files(['tests/route.coffee', 'tests/client.html', 'tests/client.coffee'], 'client');
api.addFiles(['tests/route.coffee', 'tests/client.html', 'tests/client.coffee'], 'client');
})
12 changes: 10 additions & 2 deletions server/entry.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,21 @@ Meteor.startup ->
entryCreateUser: (user) ->
check user, Object
profile = AccountsEntry.settings.defaultProfile || {}
if user.username
# both username & email provided
if user.username && user.email
userId = Accounts.createUser
username: user.username,
email: user.email,
password: user.password,
profile: _.extend(profile, user.profile)
else
# only username provided
else if user.username && !user.email
userId = Accounts.createUser
username: user.username,
password: user.password,
profile: _.extend(profile, user.profile)
# only email provided
else if user.email && !user.username
userId = Accounts.createUser
email: user.email
password: user.password
Expand Down
12 changes: 11 additions & 1 deletion shared/router.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ Router.map ->
onBeforeAction: ->
Session.set('entryError', undefined)
Session.set('buttonText', 'in')
Session.set('fromWhere', Router.current().path)
onRun: ->
if Meteor.userId()
Router.go AccountsEntry.settings.dashboardRoute
Expand Down Expand Up @@ -75,3 +74,14 @@ Router.map ->
onBeforeAction: ->
Session.set('entryError', undefined)
Session.set('resetToken', @params.resetToken)

# Get all the accounts-entry routes one time
exclusions = [];
_.each Router.routes, (route)->
exclusions.push route.name

# Change the fromWhere session variable when you leave a path
Router.onStop ->
# If the route is an entry route, no need to save it
if (!_.contains(exclusions, Router.current().route.name))
Session.set('fromWhere', Router.current().path)
10 changes: 5 additions & 5 deletions smart.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "accounts-entry",
"description": "A meteorite package that relies on Iron Router and gives you whole-page login styles.",
"homepage": "https://github.com/Differential/accounts-entry",
"homepage": "https://github.com/nunohvidal/accounts-entry",
"author": "Differential (http://differential.io)",
"version": "0.8.1",
"git": "https://github.com/Differential/accounts-entry.git",
"version": "0.9.1",
"git": "https://github.com/nunohvidal/accounts-entry.git",
"packages": {
"iron-router": "0.8.2",
"accounts-t9n": "0.0.5",
"iron-router": "",
"accounts-t9n": "",
"simple-form": ""
}
}
Loading