Merge pull request #376 from niklasdstrom/remove-unused-signin

Remove unused signin
This commit is contained in:
Sacha Greif 2014-09-08 14:48:25 +09:00
commit 06310452d4
9 changed files with 13 additions and 173 deletions

View file

@ -156,7 +156,7 @@ Template.comment_item.events({
'click .not-upvoted .upvote': function(e, instance){
e.preventDefault();
if(!Meteor.user()){
Router.go('/signin');
Router.go(getSigninUrl());
throwError(i18n.t("Please log in first"));
}
Meteor.call('upvoteComment', this, function(error, result){
@ -166,7 +166,7 @@ Template.comment_item.events({
'click .upvoted .upvote': function(e, instance){
e.preventDefault();
if(!Meteor.user()){
Router.go('/signin');
Router.go(getSigninUrl());
throwError(i18n.t("Please log in first"));
}
Meteor.call('cancelUpvoteComment', this, function(error, result){
@ -176,7 +176,7 @@ Template.comment_item.events({
'click .not-downvoted .downvote': function(e, instance){
e.preventDefault();
if(!Meteor.user()){
Router.go('/signin');
Router.go(getSigninUrl());
throwError(i18n.t("Please log in first"));
}
Meteor.call('downvoteComment', this, function(error, result){
@ -186,11 +186,11 @@ Template.comment_item.events({
'click .downvoted .downvote': function(e, instance){
e.preventDefault();
if(!Meteor.user()){
Router.go('/signin');
Router.go(getSigninUrl());
throwError(i18n.t("Please log in first"));
}
Meteor.call('cancelDownvoteComment', this, function(error, result){
trackEvent("post downvote cancelled", {'commentId':instance.data._id, 'postId': instance.data.post, 'authorId':instance.data.userId});
});
}
});
});

View file

@ -15,11 +15,11 @@ Template[getTemplate('postUpvote')].events({
var post = this;
e.preventDefault();
if(!Meteor.user()){
Router.go('/sign-in');
Router.go(getSigninUrl());
throwError(i18n.t("Please log in first"));
}
Meteor.call('upvotePost', post, function(error, result){
trackEvent("post upvoted", {'_id': post._id});
});
}
});
});

View file

@ -1,14 +0,0 @@
<template name="forgot_password">
<div class="grid-small grid-block dialog user-edit">
<form>
<h2>{{i18n "Forgot Password?"}}</h2>
<div class="control-group">
<label>{{i18n "Email"}}</label>
<div class="controls"><input id="email" name="email" type="text" value="" /></div>
</div>
<div class="form-actions">
<input type="submit" class="button" value="{{i18n "Reset Password"}}" />
</div>
</form>
</div>
</template>

View file

@ -1,14 +0,0 @@
Template[getTemplate('forgot_password')].events({
'click input[type=submit]': function(e){
e.preventDefault();
var options=new Object();
options.email=$('#email').val();
Accounts.forgotPassword(options, function(error){
if(error){
console.log(error);
}else{
throwError(i18n.t("Password reset link sent!"));
}
});
}
});

View file

@ -1,25 +0,0 @@
<template name="signin">
<div class="grid-small grid-block dialog signin">
<h2>{{i18n "Sign In"}}</h2>
<div class="twitter-signup twitter-auth">
<a class="twitter-button button" href="#">{{i18n "Sign In/Sign Up with Twitter"}}</a>
</div>
<div class="regular-signup regular-auth">
<form>
<div class="control-group">
<label>{{i18n "Username"}}</label>
<div class="controls"><input id="username" type="text" value="" /></div>
</div>
<div class="control-group">
<label>{{i18n "Password"}}</label>
<div class="controls"><input id="password" type="password" value="" /></div>
</div>
<div class="form-actions">
<a href="/forgot_password">{{i18n "Forgot password?"}}</a>
<input type="submit" class="button" value="{{i18n "Sign In"}}" />
</div>
</form>
</div>
</div>
<p class="grid-small footer-notice">{{i18n "Don't have an account?"}} <a href="signup" id="signup">{{i18n "Sign up!"}}</a></p>
</template>

View file

@ -1,29 +0,0 @@
Template[getTemplate('signin')].events({
'click input[type=submit]': function(event){
event.preventDefault();
var username = $('#username').val();
var password = $('#password').val();
Meteor.loginWithPassword(username, password, function(err){
if(err){
console.log(err);
throwError(err.reason);
}
});
},
'click #signup': function(){
// Session.set('state', 'signup');
Router.go('/signup');
},
'click .twitter-button': function(){
Meteor.loginWithTwitter(function(){
Router.go('/');
});
},
'click .facebook-button': function(){
Meteor.loginWithFacebook(function(){
Router.go('/');
});
}
});

View file

@ -1,28 +0,0 @@
<template name="signup">
<div class="grid-small grid-block dialog signup">
<h2>Sign Up</h2>
<div class="twitter-signup twitter-auth">
<a class="twitter-button button" href="#">{{i18n "Sign In/Sign Up with Twitter"}}</a>
</div>
<div class="regular-signup regular-auth">
<form>
<div class="control-group">
<label>{{i18n "Username"}}</label>
<div class="controls"><input id="username" name="username" type="text" value="" /></div>
</div>
<div class="control-group">
<label>{{i18n "Email"}}</label>
<div class="controls"><input id="email" name="email" type="text" value="" /></div>
</div>
<div class="control-group">
<label>{{i18n "Password"}}</label>
<div class="controls"><input id="password" name="password" type="password" value="" /></div>
</div>
<div class="form-actions">
<input type="submit" class="button" value="{{i18n "Sign Up"}}" />
</div>
</form>
</div>
</div>
<p class="grid-small footer-notice">{{i18n "Already have an account?"}} <a href="signin" id="signin">{{i18n "Sign in!"}}</a></p>
</template>

View file

@ -1,33 +0,0 @@
Template[getTemplate('signup')].events({
'click input[type=submit]': function(event){
event.preventDefault();
var username = $('#username').val();
var email = $('#email').val();
var password = $('#password').val();
if(!username || !email || !password){
throwError(i18n.t('Please fill in all fields'));
return false;
}
Accounts.createUser({
username: username
, email: email
, password: password
}, function(err){
if(err){
console.log(err);
}else{
Router.go('/');
}
});
},
'click #signin': function(){
Router.go('/signin');
},
'click .twitter-button': function(){
Meteor.loginWithTwitter(function(){
Router.go('/');
});
}
});

View file

@ -65,12 +65,9 @@ Comment Submit
--------------------
User Profie
User Edit
Forgot Password
Account
All Users
Unsubscribe (from notifications)
Sign Up
Sign In
6) Misc Routes
--------------------
@ -137,7 +134,11 @@ Router._filters = {
isLoggedIn: function(pause) {
if (!(Meteor.loggingIn() || Meteor.user())) {
throwError(i18n.t('Please Sign In First.'));
this.render('signin');
var current = getCurrentRoute();
if (current){
Session.set('fromWhere', current);
}
this.render('entrySignIn');
pause();
}
},
@ -248,7 +249,7 @@ if(Meteor.isClient){
Router.onBeforeAction(filters.canView, {except: ['entrySignIn', 'entrySignUp', 'entryForgotPassword', 'entryResetPassword', 'entrySignOut']});
Router.onBeforeAction(filters.hasCompletedProfile);
Router.onBeforeAction(filters.isLoggedIn, {only: ['post_submit']});
Router.onBeforeAction(filters.isLoggedOut, {only: ['signin', 'signup']});
Router.onBeforeAction(filters.isLoggedOut, {only: []});
Router.onBeforeAction(filters.canPost, {only: ['posts_pending', 'post_submit']});
Router.onBeforeAction(filters.canEditPost, {only: ['post_edit']});
Router.onBeforeAction(filters.canEditComment, {only: ['comment_edit']});
@ -616,12 +617,6 @@ Meteor.startup(function () {
controller: AccountController
});
// Forgot Password
this.route('forgot_password', {
template: getTemplate('forgot_password'),
});
// All Users
this.route('all-users', {
@ -658,18 +653,6 @@ Meteor.startup(function () {
}
});
// User Sign-Up
this.route('signup', {
template: getTemplate('signup'),
});
// User Sign-In
this.route('signin', {
template: getTemplate('signin'),
});
// -------------------------------------------- Other -------------------------------------------- //