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 iron router error: route never dispatch in case Meteor.loggingIn() i... #358

Open
wants to merge 14 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
7 changes: 3 additions & 4 deletions client/entry.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,12 @@ AccountsEntry =
signInRequired: (router, extraCondition) ->
extraCondition ?= true
unless Meteor.loggingIn()
if Meteor.user() and extraCondition
router.next()
else
if not (Meteor.user() and extraCondition)
Session.set('fromWhere', router.url)
Router.go('/sign-in')
Session.set('entryError', t9n('error.signInRequired'))
router.next()
router.next()


@AccountsEntry = AccountsEntry

Expand Down
14 changes: 5 additions & 9 deletions client/entry.less
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,6 @@
}
}

&#entry-google {
background: #db5a3c;
color: #fff;

&:hover {
background: #CA4C2E;
}
}

&#entry-github {
background: #666;
color: #fff;
Expand All @@ -100,6 +91,11 @@
}
}
}

a {
display: block;
margin: auto;
}
}

.email-option {
Expand Down
9 changes: 6 additions & 3 deletions client/helpers.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ UI.registerHelper 'otherLoginServices', ->
Accounts.oauth.serviceNames().length > 0

UI.registerHelper 'loginServices', ->
Accounts.oauth.serviceNames()
["google", "dropbox", "box", "onedrive"]

UI.registerHelper 'showSignupCode', ->
AccountsEntry.settings.showSignupCode is true
Expand All @@ -50,9 +50,12 @@ UI.registerHelper 'containerCSSClass', ->
"container-fluid"
else
"container"

UI.registerHelper 'rowCSSClass', ->
if AccountsEntry.settings.fluidLayout is true
"row-fluid"
else
"row"
"row"

UI.registerHelper 'isPrimaryService', (serviceName)->
serviceName is 'google' or serviceName is 'dropbox'
2 changes: 1 addition & 1 deletion client/t9n/english.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ en =
"User not found": "User not found"

error:
minChar: "7 character minimum password."
minChar: "6 character minimum password."
pwOneLetter: "Password requires 1 letter."
pwOneDigit: "Password must have at least one digit."
usernameRequired: "Username is required."
Expand Down
48 changes: 29 additions & 19 deletions client/views/forgotPassword/forgotPassword.html
Original file line number Diff line number Diff line change
@@ -1,25 +1,35 @@
<template name='entryForgotPassword'>
<div class="{{containerCSSClass}}">
<div class="{{rowCSSClass}}">
{{#if logo}}
<div class="entry-logo">
<a href="/"><img src="{{logo}}" alt="logo"></a>
</div>
{{/if}}
<div class="entry col-md-4 col-md-offset-4">
{{#if error}}
<div class='alert alert-danger'>{{error}}</div>
{{/if}}
<h3>{{t9n 'forgotPassword'}}</h3>
<form id='forgotPassword'>
<div class="form-group">
<input type="email" name="forgottenEmail" class="form-control" placeholder="{{t9n 'emailAddress'}}" value=''>
<div class="sign-in-page forgot-password-page">
<div class="{{containerCSSClass}}">
<div class="{{rowCSSClass}}">
{{#if logo}}
<div class="entry-logo">
<a href="/"><img src="{{logo}}" alt="logo"></a>
</div>
<button type="submit" class="btn btn-default">{{t9n 'emailResetLink'}}</button>
</form>
{{#if showSignupCode}}
<p class="entry-signup-cta">{{t9n 'dontHaveAnAccount'}} <a href="{{pathFor 'entrySignUp'}}">{{t9n 'signUp'}}</a></p>
{{/if}}
<div class="col-md-12">
<div class="header-signin">
<h1>forgot password</h1>
<p>put your email address you registered with lumin, we will send an email with a link to recover your password</p>
</div>
</div>
</div>
<div class="row">
<div class="entry col-md-offset-3 col-md-6">
{{#if error}}
<div class='alert alert-danger'>{{error}}</div>
{{/if}}
<form class="entry-form" id='forgotPassword'>
<div class="form-group">
<label>Your email address:</label>
<input type="email" name="forgottenEmail" class="form-control" value=''>
</div>
<button type="submit" class="submit btn btn-default">send reset link</button>
</form>
{{#if showSignupCode}}
<p class="entry-signup-cta">{{t9n 'dontHaveAnAccount'}} <a href="{{pathFor 'entrySignUp'}}">{{t9n 'signUp'}}</a></p>
{{/if}}
</div>
</div>
</div>
</div>
Expand Down
18 changes: 9 additions & 9 deletions client/views/resetPassword/resetPassword.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ Template.entryResetPassword.events

'submit #resetPassword': (event) ->
event.preventDefault()
password = $('input[type="password"]').val()
password = $('input[name="new-password"]').val()

passwordErrors = do (password)->
errMsg = []
msg = false
if password.length < 7
if password.length < 6
errMsg.push t9n("error.minChar")
if password.search(/[a-z]/i) < 0
errMsg.push t9n("error.pwOneLetter")
if password.search(/[0-9]/) < 0
errMsg.push t9n("error.pwOneDigit")
# if password.search(/[a-z]/i) < 0
# errMsg.push t9n("error.pwOneLetter")
# if password.search(/[0-9]/) < 0
# errMsg.push t9n("error.pwOneDigit")

if errMsg.length > 0
msg = ""
Expand All @@ -34,7 +34,7 @@ Template.entryResetPassword.events

Accounts.resetPassword Session.get('resetToken'), password, (error) ->
if error
Session.set('entryError', (error.reason || "Unknown error"))
Session.set 'entryError', (error.reason || "Unknown error")
else
Session.set('resetToken', null)
Router.go AccountsEntry.settings.dashboardRoute
Session.set 'resetToken', null
Router.go AccountsEntry.settings.dashboardRoute
7 changes: 4 additions & 3 deletions client/views/resetPassword/resetPassword.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@
<a href="/"><img src="{{logo}}" alt="logo"></a>
</div>
{{/if}}
<div class="entry col-md-4 col-md-offset-4">
<div class="entry-form col-md-4 col-md-offset-4 sign-in-page reset-password">
{{#if error}}
<div class='alert alert-danger'>{{error}}</div>
{{/if}}
<h3>{{t9n "resetYourPassword"}}</h3>
<form id='resetPassword'>
<form id='resetPassword' class='entry-form'>
<div class="form-group">
<label>Password:</label>
<input type="password" name="new-password" class="form-control" value=''>
</div>
<button type="submit" class="btn btn-default">{{t9n "updateYourPassword"}}</button>
<button type="submit" class="submit btn btn-default" style="width: 83% !important;">{{t9n "updateYourPassword"}}</button>
</form>
{{#if showSignupCode}}
<p class="entry-signup-cta">{{t9n 'dontHaveAnAccount'}} <a href="{{pathFor 'entrySignUp'}}">{{t9n 'signUp'}}</a></p>
Expand Down
101 changes: 62 additions & 39 deletions client/views/signIn/signIn.html
Original file line number Diff line number Diff line change
@@ -1,47 +1,70 @@
<template name='entrySignIn'>
<div class="{{containerCSSClass}}">
<div class="{{rowCSSClass}}">
{{#if logo}}
<div class="entry-logo">
<a href="/"><img src="{{logo}}" alt="logo"></a>
</div>
{{/if}}
<div class="entry col-md-4 col-md-offset-4">
{{#if otherLoginServices}}
<div class="entry-social">
{{#each loginServices}}
{{> entrySocial}}
{{/each}}
{{#if passwordLoginService}}
<div class="email-option">
<strong class="line-thru or-sign-in">{{t9n "OR"}}</strong>
<div class="sign-in-page">
<div class="{{containerCSSClass}}">
<div class="{{rowCSSClass}}">
{{#if logo}}
<div class="entry-logo">
<a href="/"><img src="{{logo}}" alt="logo"></a>
</div>
{{/if}}
</div>
{{/if}}
{{> entryError}}
{{#unless otherLoginServices}}
<div class="email-option">
<h3>{{t9n "signIn"}}</h3>
<div class="col-md-12">
<div class="header-signin">
<h1>Login</h1>
<p>Just take 1 min to get all lumin features</p>
</div>
{{/unless}}
{{#if passwordLoginService}}
<form class="entry-form" id='signIn'>
<div class="form-group">
<input autofocus name="email" type="{{emailInputType}}" class="form-control" value='{{email}}' placeholder="{{emailPlaceholder}}" autocapitalize="none" autocomplete="off" autocorrect="off">
</div>
<div class="form-group">
<input name="password" type="password" class="form-control" value='{{password}}' placeholder="{{t9n 'password'}}">
</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>
</div>
<div class="entry col-md-12">
<div class="row">
{{#if passwordLoginService}}
<div class="col-md-6">
<form class="entry-form" id='signIn'>
<h3>With your email:</h3>
{{> entryError}}
<div class="form-group">
<label>Your email address:</label>
<input autofocus name="email" type="{{emailInputType}}" class="form-control" value='{{email}}' autocapitalize="none" autocomplete="off" autocorrect="off">
</div>
<div class="form-group">
<label>Password:</label>
<input name="password" type="password" class="form-control" value='{{password}}'>
</div>
{{#unless isUsernameOnly}}
<div class="row">
<div class="col-md-4">
<button type="submit" class="submit btn btn-block btn-default">
<i class="icon-try"></i>
<span>log me in</span>
</button>
</div>
<div class="col-md-8">
<div class="forgot">
<a href="{{pathFor 'entryForgotPassword'}}"><i class="icon-right"></i><span>Forgot ID/PW?</span></a>
{{#if showCreateAccountLink}}
<a href="{{pathFor 'entrySignUp'}}"><i class="icon-right"></i><span>Register new account</span></a>
{{/if}}
</div>
</div>
</div>
{{/unless}}
</form>
</div>
{{/if}}

{{#if otherLoginServices}}
<div class="entry-social col-md-6">
<h3>Log in with:</h3>
{{#each loginServices}}
{{> entrySocial}}
{{/each}}
</div>
{{/if}}
{{#unless otherLoginServices}}
<div class="email-option">
<h3>{{t9n "signIn"}}</h3>
</div>
{{/unless}}
</form>
{{/if}}
{{#if showCreateAccountLink}}
<p class="entry-signup-cta">{{t9n "dontHaveAnAccount"}} <a href="{{pathFor 'entrySignUp'}}">{{t9n "signUp"}}</a></p>
{{/if}}
</div>
</div>
</div>
</div>
</div>
Expand Down
5 changes: 3 additions & 2 deletions client/views/signUp/extraSignUpFields.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@

<template name="_entryExtraSignUpField">
{{#if isTextField }}
<div class="form-group">
{{text_field field type=type required=required label=label placeholder=placeholder }}
<div class="form-group your-name">
<label>Your name:</label>
{{text_field field type=type required=required}}
</div>
{{/if}}

Expand Down
26 changes: 21 additions & 5 deletions client/views/signUp/signUp.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,31 @@ AccountsEntry.entrySignUpEvents = {
fields = AccountsEntry.settings.passwordSignupFields


# passwordErrors = do (password)->
# errMsg = []
# msg = false
# if password.length < 7
# errMsg.push t9n("error.minChar")
# if password.search(/[a-z]/i) < 0
# errMsg.push t9n("error.pwOneLetter")
# if password.search(/[0-9]/) < 0
# errMsg.push t9n("error.pwOneDigit")
#
# if errMsg.length > 0
# msg = ""
# errMsg.forEach (e) ->
# msg = msg.concat "#{e}\r\n"
#
# Session.set 'entryError', msg
# return true
#
# return false

passwordErrors = do (password)->
errMsg = []
msg = false
if password.length < 7
if password.length < 6
errMsg.push t9n("error.minChar")
if password.search(/[a-z]/i) < 0
errMsg.push t9n("error.pwOneLetter")
if password.search(/[0-9]/) < 0
errMsg.push t9n("error.pwOneDigit")

if errMsg.length > 0
msg = ""
Expand Down
Loading