diff --git a/README.md b/README.md index d1d6083..b9d37d1 100644 --- a/README.md +++ b/README.md @@ -45,14 +45,17 @@ Base comes with a pre-defined file structure common to all projects along with s ---------/vendor ---------/views ------------/public ----------------login.html ----------------recover-password.html ----------------reset-password.html ----------------signup.html +---------------_login.scss +---------------_recover-password.scss +---------------_reset-password.scss +---------------_signup.scss ---------app.scss -------/views ----------/example -------------example.html +-------/views +---------/public +------------login.html +------------recover-password.html +------------reset-password.html +------------signup.html ---/collections ------example.coffee ---/lib diff --git a/client/controllers/public/login.coffee b/client/controllers/public/login.coffee index 7c3308e..c27a125 100644 --- a/client/controllers/public/login.coffee +++ b/client/controllers/public/login.coffee @@ -19,6 +19,18 @@ Template.login.helpers( # Events Template.login.events( - 'click .example': (e,t) -> - # Code to run for example event. + 'submit form': (e) -> + + # Prevent form from submitting. + e.preventDefault() + + # Grab the user's details. + user = + email: $('[name="emailAddress"]').val() + password: $('[name="password"]').val() + + # Create the user's account. + Meteor.loginWithPassword(user.email, user.password, (error)-> + alert error.reason if error + ) ) diff --git a/client/controllers/public/signup.coffee b/client/controllers/public/signup.coffee index f8b569f..f6a169a 100644 --- a/client/controllers/public/signup.coffee +++ b/client/controllers/public/signup.coffee @@ -19,6 +19,18 @@ Template.signup.helpers( # Events Template.signup.events( - 'click .example': (e,t) -> - # Code to run for example event. + 'submit form': (e) -> + + # Prevent form from submitting. + e.preventDefault() + + # Grab the user's details. + user = + email: $('[name="emailAddress"]').val() + password: $('[name="password"]').val() + + # Create the user's account. + Accounts.createUser(user, (error)-> + alert error.reason if error + ) ) diff --git a/client/routes/filters.coffee b/client/routes/filters.coffee index e0517a2..69a947a 100644 --- a/client/routes/filters.coffee +++ b/client/routes/filters.coffee @@ -11,7 +11,7 @@ re-route them to the login screen. ### checkUserLoggedIn = -> - if not Meteor.loggingIn() or Meteor.user() + if not Meteor.loggingIn() and not Meteor.user() Router.go '/login' @pause diff --git a/client/stylesheets/sass/application.scss b/client/stylesheets/sass/application.scss new file mode 100644 index 0000000..327a830 --- /dev/null +++ b/client/stylesheets/sass/application.scss @@ -0,0 +1,5 @@ +/* Globals */ +@import "globals/extends"; + +/* Views */ +@import "views/public/login"; diff --git a/client/stylesheets/sass/globals/_extends.scss b/client/stylesheets/sass/globals/_extends.scss new file mode 100644 index 0000000..46042ee --- /dev/null +++ b/client/stylesheets/sass/globals/_extends.scss @@ -0,0 +1,17 @@ +/* + Clearfix + via http://nicolasgallagher.com/micro-clearfix-hack +*/ +%clearfix { + *zoom: 1; + + &:before, + &:after { + display: table; + content: ""; + } + + &:after { + clear: both; + } +} diff --git a/client/stylesheets/sass/globals/_mixins.scss b/client/stylesheets/sass/globals/_mixins.scss new file mode 100644 index 0000000..e69de29 diff --git a/client/stylesheets/sass/views/public/_login.scss b/client/stylesheets/sass/views/public/_login.scss new file mode 100644 index 0000000..85066fb --- /dev/null +++ b/client/stylesheets/sass/views/public/_login.scss @@ -0,0 +1,4 @@ +.login label { + display: block; + @extend %clearfix; +} diff --git a/client/views/public/login.html b/client/views/public/login.html index b95c344..aad8e41 100644 --- a/client/views/public/login.html +++ b/client/views/public/login.html @@ -1,3 +1,16 @@ diff --git a/client/views/public/signup.html b/client/views/public/signup.html index 09647ae..56e2907 100644 --- a/client/views/public/signup.html +++ b/client/views/public/signup.html @@ -1,3 +1,16 @@