got setup script to work

This commit is contained in:
David Baldwynn 2016-05-10 00:25:00 -07:00
parent 883a944c83
commit 898f31181b
11 changed files with 63 additions and 35 deletions

14
a.txt
View file

@ -1,14 +0,0 @@
APP_NAME=
APP_DESC=
APP_KEYWORDS=
SIGNUP_DISABLED=false
NODE_ENV=dev
MAILER_SERVICE_PROVIDER=1und1
MAILER_EMAIL_ID=
MAILER_PASSWORD=
MAILER_FROM=
BASE_URL=127.0.0.1
PORT=3000
GOOGLE_ANALYTICS_ID=
email=
password=

View file

@ -77,6 +77,11 @@
var user = {{ user | json | safe }};
</script>
<!--Embedding The signupDisabled Boolean-->
<script type="text/javascript">
var signupDisabled = {{signupDisabled}};
</script>
<!--Bower JS dependencies-->
{% for bowerJSFile in bowerJSFiles %}
<script type="text/javascript" src="{{bowerJSFile}}"></script>

2
config/env/all.js vendored
View file

@ -10,7 +10,7 @@ module.exports = {
port: process.env.PORT || 3000,
templateEngine: 'swig',
signupDisabled: process.env.SIGNUP_DISABLED || false,
signupDisabled: !!process.env.SIGNUP_DISABLED || false,
baseUrl: '',
tempUserCollection: 'temporary_users',

View file

@ -31,7 +31,7 @@ var fs = require('fs-extra'),
module.exports = function(db) {
// Initialize express app
var app = express();
// Globbing model files
config.getGlobbedFiles('./app/models/**/*.js').forEach(function(modelPath) {
require(path.resolve(modelPath));
@ -40,6 +40,7 @@ module.exports = function(db) {
// Setting application local variables
app.locals.google_analytics_id = config.app.google_analytics_id;
app.locals.title = config.app.title;
app.locals.signupDisabled = config.signupDisabled;
app.locals.description = config.app.description;
app.locals.keywords = config.app.keywords;
@ -52,7 +53,7 @@ module.exports = function(db) {
//Setup Prerender.io
app.use(require('prerender-node').set('prerenderToken', process.env.PRERENDER_TOKEN));
// Passing the request url to environment locals
app.use(function(req, res, next) {
if(config.baseUrl === ''){
@ -107,7 +108,7 @@ module.exports = function(db) {
app.use(helmet.ienoopen());
app.disable('x-powered-by');
// Setting the app router and static folder
app.use('/', express.static(path.resolve('./public')));
app.use('/uploads', express.static(path.resolve('./uploads')));
@ -127,7 +128,7 @@ module.exports = function(db) {
cookie: config.sessionCookie,
name: config.sessionName
}));
// use passport session
app.use(passport.initialize());
app.use(passport.session());
@ -143,7 +144,7 @@ module.exports = function(db) {
require(path.resolve(routePath))(app);
});
// Add headers for Sentry
/*
app.use(function (req, res, next) {

View file

@ -14,7 +14,7 @@
"env" : {
"NODE_ENV": "production",
"BASE_URL": "stage.tellform.com"
}
}
},
"prod" : {
"user" : "polydaic",

View file

@ -2181,7 +2181,7 @@ angular.module('users').config(['$stateProvider',
var checkLoggedin = function($q, $timeout, $state, User, Auth) {
var deferred = $q.defer();
// console.log(Auth.ensureHasCurrentUser(User));
console.log(Auth.ensureHasCurrentUser(User));
if (Auth.currentUser && Auth.currentUser.email) {
$timeout(deferred.resolve);
@ -2202,6 +2202,15 @@ angular.module('users').config(['$stateProvider',
};
checkLoggedin.$inject = ["$q", "$timeout", "$state", "User", "Auth"];
var checkSignupDisabled = function($window, $timeout, $q) {
console.log($window.signupDisabled);
var deferred = $q.defer();
$timeout(deferred.reject());
return deferred.promise;
//return !$window.signupDisabled;
};
checkSignupDisabled.$inject = ["$window", "$timeout", "$q"];
// Users state routing
$stateProvider.
state('profile', {
@ -2225,12 +2234,17 @@ angular.module('users').config(['$stateProvider',
url: '/settings/accounts',
templateUrl: 'modules/users/views/settings/social-accounts.client.view.html'
}).
state('signup', {
resolve: {
isDisabled: checkSignupDisabled
},
url: '/signup',
templateUrl: 'modules/users/views/authentication/signup.client.view.html'
}).
state('signup-success', {
resolve: {
isDisabled: checkSignupDisabled
},
url: '/signup-success',
templateUrl: 'modules/users/views/authentication/signup-success.client.view.html'
}).
@ -2242,7 +2256,6 @@ angular.module('users').config(['$stateProvider',
url: '/access_denied',
templateUrl: 'modules/users/views/authentication/access-denied.client.view.html'
}).
state('resendVerifyEmail', {
url: '/verify',
templateUrl: 'modules/users/views/verify/resend-verify-email.client.view.html'
@ -2270,6 +2283,7 @@ angular.module('users').config(['$stateProvider',
});
}
]);
'use strict';
angular.module('users').controller('AuthenticationController', ['$scope', '$location', '$state', '$rootScope', 'User', 'Auth',

File diff suppressed because one or more lines are too long

View file

@ -1,7 +1,9 @@
'use strict';
angular.module('core').controller('HeaderController', ['$rootScope', '$scope', 'Menus', '$state', 'Auth', 'User',
function ($rootScope, $scope, Menus, $state, Auth, User) {
angular.module('core').controller('HeaderController', ['$rootScope', '$scope', 'Menus', '$state', 'Auth', 'User', '$window'
function ($rootScope, $scope, Menus, $state, Auth, User, $window) {
$rootScope.signupDisabled = $window.signupDisabled;
$scope.user = $rootScope.user = Auth.ensureHasCurrentUser(User);
$scope.authentication = $rootScope.authentication = Auth;

View file

@ -27,7 +27,7 @@
</li>
</ul>
<ul class="nav navbar-nav navbar-right" data-ng-hide="authentication.isAuthenticated()">
<li ui-route="/signup" ng-class="{active: $uiRoute}">
<li ng-if="$root.signupDisabled" ui-route="/signup" ng-class="{active: $uiRoute}">
<a href="/#!/signup">Sign Up</a>
</li>
<li class="divider-vertical"></li>

View file

@ -7,7 +7,7 @@ angular.module('users').config(['$stateProvider',
var checkLoggedin = function($q, $timeout, $state, User, Auth) {
var deferred = $q.defer();
// console.log(Auth.ensureHasCurrentUser(User));
//console.log(Auth.ensureHasCurrentUser(User));
if (Auth.currentUser && Auth.currentUser.email) {
$timeout(deferred.resolve);
@ -27,6 +27,17 @@ angular.module('users').config(['$stateProvider',
return deferred.promise;
};
var checkSignupDisabled = function($window, $timeout, $q) {
var deferred = $q.defer();
if($window.signupDisabled) {
$timeout(deferred.reject());
}else{
$timeout(deferred.resolve());
}
return deferred.promise;
};
// Users state routing
$stateProvider.
state('profile', {
@ -50,12 +61,17 @@ angular.module('users').config(['$stateProvider',
url: '/settings/accounts',
templateUrl: 'modules/users/views/settings/social-accounts.client.view.html'
}).
state('signup', {
resolve: {
isDisabled: checkSignupDisabled
},
url: '/signup',
templateUrl: 'modules/users/views/authentication/signup.client.view.html'
}).
state('signup-success', {
resolve: {
isDisabled: checkSignupDisabled
},
url: '/signup-success',
templateUrl: 'modules/users/views/authentication/signup-success.client.view.html'
}).
@ -67,7 +83,6 @@ angular.module('users').config(['$stateProvider',
url: '/access_denied',
templateUrl: 'modules/users/views/authentication/access-denied.client.view.html'
}).
state('resendVerifyEmail', {
url: '/verify',
templateUrl: 'modules/users/views/verify/resend-verify-email.client.view.html'
@ -94,4 +109,4 @@ angular.module('users').config(['$stateProvider',
templateUrl: 'modules/users/views/password/reset-password.client.view.html'
});
}
]);
]);

View file

@ -36,12 +36,17 @@
<a href="/#!/password/forgot">Forgot your password?</a>
</div>
<div class="text-center form-group">
<button class="btn btn-primary" ng-click="signin()">Sign in</button>&nbsp; or&nbsp;
<a href="/#!/signup">Sign up</a>
<button class="btn btn-primary" ng-click="signin()">Sign in</button>
<span ng-if="$root.signupDisabled">
&nbsp; or&nbsp;
<a href="/#!/signup">Sign up</a
</span>
</div>
</fieldset>
</form>
</div>
</section>
</section>