diff --git a/server/boot/authentication.js b/server/boot/authentication.js
index 38ceaa63de..a3a9b05ad5 100644
--- a/server/boot/authentication.js
+++ b/server/boot/authentication.js
@@ -29,23 +29,25 @@ module.exports = function enableAuthentication(app) {
const api = app.loopback.Router();
const { AuthToken, User } = app.models;
- router.get('/signup', (req, res) => res.redirect(301, '/login'));
router.get('/email-signin', (req, res) => res.redirect(301, '/login'));
router.get('/signin', (req, res) => res.redirect(301, '/login'));
router.get('/signout', (req, res) => res.redirect(301, '/logout'));
+ router.get('/signup', (req, res) => res.redirect(301, '/deprecated-signup'));
- function getEmailSignin(req, res) {
+ function getLegacySignUp(req, res) {
if (isSignUpDisabled) {
return res.render('account/beta', {
title: 'New sign ups are disabled'
});
}
- return res.render('account/email-signin', {
+ return res.render('account/deprecated-signup', {
title: 'Sign in to freeCodeCamp using your Email Address'
});
}
-
- router.get('/login', ifUserRedirect, getEmailSignin);
+ router.get('/deprecated-signup', ifUserRedirect, getLegacySignUp);
+ router.get('/login',
+ ifUserRedirect,
+ (req, res) => res.redirect(301, '/auth/auth0'));
router.get('/logout', (req, res) => {
req.logout();
diff --git a/server/passport-providers.js b/server/passport-providers.js
index 59816d6c60..7ee12a9ceb 100644
--- a/server/passport-providers.js
+++ b/server/passport-providers.js
@@ -172,6 +172,7 @@ export default {
clientID: process.env.AUTH0_CLIENT_ID,
clientSecret: process.env.AUTH0_CLIENT_SECRET,
domain: process.env.AUTH0_DOMAIN,
+ cookieDomain: 'freeCodeCamp.org',
callbackURL: '/auth/auth0/callback',
authPath: '/auth/auth0',
callbackPath: '/auth/auth0/callback',
diff --git a/server/views/account/deprecated-signin.jade b/server/views/account/deprecated-signin.jade
index 0cb67ef558..9d51f4f018 100644
--- a/server/views/account/deprecated-signin.jade
+++ b/server/views/account/deprecated-signin.jade
@@ -1,26 +1,34 @@
extends ../layout
block content
- .text-center
- h2 If you originally signed up using one of these methods, you can sign in and add your email address to your account:
- br
- a.btn.btn-lg.btn-block.btn-social.btn-github(href='/auth/github')
- i.fa.fa-github
- | Sign in with GitHub
- a.btn.btn-lg.btn-block.btn-social.btn-facebook(href='/auth/facebook')
- i.fa.fa-facebook
- | Sign in with Facebook
- a.btn.btn-lg.btn-block.btn-social.btn-google(href='/auth/google')
- i.fa.fa-google
- | Sign in with Google
- a.btn.btn-lg.btn-block.btn-social.btn-linkedin(href='/auth/linkedin')
- i.fa.fa-linkedin
- | Sign in with LinkedIn
- a.btn.btn-lg.btn-block.btn-social.btn-twitter(href='/auth/twitter')
- i.fa.fa-twitter
- | Sign in with Twitter
- br
- p
- a(href="/signin") Or click here to go back.
+ .container
+ .col-xs-12
+ .row
+ .text-center
+ h3 Sign in with one of these options if you used them as your original sign up methods :
+ br
+ a.btn.btn-lg.btn-block.btn-social.btn-github(href='/auth/github')
+ i.fa.fa-github
+ | Sign in with GitHub
+ a.btn.btn-lg.btn-block.btn-social.btn-facebook(href='/auth/facebook')
+ i.fa.fa-facebook
+ | Sign in with Facebook
+ a.btn.btn-lg.btn-block.btn-social.btn-google(href='/auth/google')
+ i.fa.fa-google
+ | Sign in with Google
+ a.btn.btn-lg.btn-block.btn-social.btn-linkedin(href='/auth/linkedin')
+ i.fa.fa-linkedin
+ | Sign in with LinkedIn
+ a.btn.btn-lg.btn-block.btn-social.btn-twitter(href='/auth/twitter')
+ i.fa.fa-twitter
+ | Sign in with Twitter
+ br
+ h3
+ | We are unable to create new accounts using these methods
+ h4 If you haven't updated your email with us, you should do that as soon as possible,
+ | after you login here, to avoid losing access to your account.
+ br
+ p
+ a(href="/signin") Or click here to go back.
script.
$(document).ready(function() {
diff --git a/server/views/account/deprecated-signup.jade b/server/views/account/deprecated-signup.jade
new file mode 100644
index 0000000000..8d15ddffba
--- /dev/null
+++ b/server/views/account/deprecated-signup.jade
@@ -0,0 +1,15 @@
+extends ../layout
+block content
+ .container
+ .col-xs-12
+ .row
+ .text-center
+ h2 Sign up (or sign in with your existing account)
+ br
+ a.btn.btn-lg.btn-primary(href='/auth/auth0')
+ | Get a link on your email
+ .row
+ .text-center
+ br
+ a(href="/deprecated-signin")
+ | Continute with old sign in methods
diff --git a/server/views/account/email-signin.jade b/server/views/account/email-signin.jade
deleted file mode 100644
index 34602473aa..0000000000
--- a/server/views/account/email-signin.jade
+++ /dev/null
@@ -1,140 +0,0 @@
-extends ../layout
-block content
- .container
- .col-xs-12
- .row
- .col-sm-6.col-sm-offset-3.flashMessage.negative-30
- #flash-board.alert.fade.in(style='display: none;')
- button.close(type='button', data-dismiss='alert')
- span.ion-close-circled#flash-close
- #flash-content
- .row
- .text-center
- h2 Sign up (or sign in with your existing account)
- .button-spacer
- .col-sm-6.col-sm-offset-3
- form(method='POST', action='/passwordless-auth')
- input(type='hidden', name='_csrf', value=_csrf)
- .form-group
- input.input-lg.form-control(type='email', name='email', id='email', placeholder='Enter your email address', autofocus=true, required, oninvalid="this.setCustomValidity('Enter your email address')", oninput="setCustomValidity('')")
- .button-spacer
- div.checkbox
- label
- input(type='checkbox', name='quincy-emails', checked=false)
- span.cr
- i.cr-icon.fa.fa-check
- | I want weekly emails from Quincy, freeCodeCamp.org's founder.
- div.checkbox
- label
- input#terms-privacy(type='checkbox', name='terms-privacy', checked=false)
- span.cr
- i.cr-icon.fa.fa-check
- | I accept the
- a(href="/terms" target="_blank") Terms of Service
- | and
- a(href="/privacy" target="_blank") Privacy Policy
- | (required).
- .button-spacer
- button#magic-btn.btn.btn-primary.btn-lg.btn-block(type='submit')
- | Get a sign in link
- .row
- .col-sm-6.col-sm-offset-3
- br
- p.text-center
- br
- br
- a(href="/deprecated-signin") Try old sign in methods
-
- script.
- $(document).ready(function() {
- function disableMagicButton (isDisabled, isLaunched) {
- if (isDisabled) {
- $('#magic-btn')
- .prop('disabled', true)
- .html('OK - we\'re sending you an email. Open it and click sign in link.');
- } else {
- $('#magic-btn')
- .prop('disabled', true)
- .html('If you didn\'t get the email, check your spam folder, or reload the page to try again.');
- }
- }
-
- function disableMagicButtonForAgreement (isLaunched) {
- if(isLaunched) {
- $('#magic-btn')
- .prop('disabled', true)
- .html('Get a sign in link');
- return;
- } else {
- $('#magic-btn')
- .prop('disabled', false)
- .html('Get a sign in link');
- }
- }
-
- disableMagicButtonForAgreement(true);
-
- $('#terms-privacy').click(function(){
- if(this.checked) {
- disableMagicButtonForAgreement(false);
- } else {
- disableMagicButtonForAgreement(true);
- }
- });
-
- $('form').submit(function(event){
- event.preventDefault();
- $('#flash-board').hide();
- disableMagicButton(true);
- var $form = $(event.target);
- $.ajax({
- type : 'POST',
- url : $form.attr('action'),
- data : $form.serialize(),
- dataType : 'json',
- encode : true,
- xhrFields : { withCredentials: true }
- })
- .fail(error => {
- if (error.responseText){
- var data = JSON.parse(error.responseText);
- if(data.error && data.error.message) {
- $('#flash-content').html(data.error.message);
- $('#flash-board')
- .removeClass('alert-success')
- .addClass('alert-info')
- .slideDown(400)
- .delay(800)
- .fadeIn();
- disableMagicButton(false);
- }
- }
- })
- .done(data => {
- if(data && data.message) {
- var alertType = 'alert-';
- switch (data.type) {
- case 'errors': {
- alertType += 'danger';
- break
- }
- case 'success': {
- alertType += 'success';
- break
- }
- default: {
- alertType += 'info';
- }
- }
- $('#flash-content').html(data.message);
- $('#flash-board')
- .removeClass('alert-info alert-success alert-danger')
- .addClass(alertType)
- .slideDown(400)
- .delay(800)
- .fadeIn();
- disableMagicButton(false);
- }
- });
- });
- });