Remove non-react Update email views and routes
This commit is contained in:
committed by
Berkeley Martinez
parent
b32e2102ac
commit
7f657f7bd5
@ -140,16 +140,9 @@ function buildDisplayChallenges(
|
|||||||
module.exports = function(app) {
|
module.exports = function(app) {
|
||||||
const router = app.loopback.Router();
|
const router = app.loopback.Router();
|
||||||
const api = app.loopback.Router();
|
const api = app.loopback.Router();
|
||||||
<<<<<<< HEAD
|
const { AccessToken, Email, User } = app.models;
|
||||||
const { User, Email } = app.models;
|
|
||||||
const map$ = cachedMap(app.models);
|
const map$ = cachedMap(app.models);
|
||||||
=======
|
|
||||||
const User = app.models.User;
|
|
||||||
const AccessToken = app.models.AccessToken;
|
|
||||||
const Block = app.models.Block;
|
|
||||||
const { Email } = app.models;
|
|
||||||
const map$ = cachedMap(Block);
|
|
||||||
>>>>>>> Optimize code and streamline flow.
|
|
||||||
function findUserByUsername$(username, fields) {
|
function findUserByUsername$(username, fields) {
|
||||||
return observeQuery(
|
return observeQuery(
|
||||||
User,
|
User,
|
||||||
@ -176,7 +169,6 @@ module.exports = function(app) {
|
|||||||
router.get('/signout', signout);
|
router.get('/signout', signout);
|
||||||
router.get('/email-signin', getEmailSignin);
|
router.get('/email-signin', getEmailSignin);
|
||||||
router.get('/deprecated-signin', getDepSignin);
|
router.get('/deprecated-signin', getDepSignin);
|
||||||
router.get('/update-email', getUpdateEmail);
|
|
||||||
router.get('/passwordless-auth', invalidateAuthToken, getPasswordlessAuth);
|
router.get('/passwordless-auth', invalidateAuthToken, getPasswordlessAuth);
|
||||||
api.post('/passwordless-auth', postPasswordlessAuth);
|
api.post('/passwordless-auth', postPasswordlessAuth);
|
||||||
router.get(
|
router.get(
|
||||||
@ -421,15 +413,6 @@ module.exports = function(app) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getUpdateEmail(req, res) {
|
|
||||||
if (!req.user) {
|
|
||||||
return res.redirect('/');
|
|
||||||
}
|
|
||||||
return res.render('account/update-email', {
|
|
||||||
title: 'Update your Email'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function getEmailSignin(req, res) {
|
function getEmailSignin(req, res) {
|
||||||
if (req.user) {
|
if (req.user) {
|
||||||
return res.redirect('/');
|
return res.redirect('/');
|
||||||
@ -443,7 +426,7 @@ module.exports = function(app) {
|
|||||||
title: 'Sign in to freeCodeCamp using your Email Address'
|
title: 'Sign in to freeCodeCamp using your Email Address'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getEmailSignup(req, res) {
|
function getEmailSignup(req, res) {
|
||||||
if (req.user) {
|
if (req.user) {
|
||||||
return res.redirect('/');
|
return res.redirect('/');
|
||||||
|
@ -1,57 +0,0 @@
|
|||||||
extends ../layout
|
|
||||||
block content
|
|
||||||
.container
|
|
||||||
.row.flashMessage.negative-30
|
|
||||||
.col-xs-12
|
|
||||||
#flash-board.alert.fade.in(style='display: none;')
|
|
||||||
button.close(type='button', data-dismiss='alert')
|
|
||||||
span.ion-close-circled#flash-close
|
|
||||||
#flash-content
|
|
||||||
h2.text-center Update your email address here:
|
|
||||||
form.form-horizontal.update-email(method='POST', action='/api/users/#{user.id}/update-email', name="updateEmailForm")
|
|
||||||
.row
|
|
||||||
.col-sm-6.col-sm-offset-3
|
|
||||||
input(type='hidden', name='_csrf', value=_csrf)
|
|
||||||
.form-group
|
|
||||||
input.input-lg.form-control(type='email', name='email', id='email', value=user.email || '', placeholder=user.email || 'Enter your new email', autofocus, required, autocomplete="off")
|
|
||||||
.form-group
|
|
||||||
button.btn.btn-lg.btn-primary.btn-block(type='submit')= !user.email || user.emailVerified ? 'Update my Email' : 'Verify Email'
|
|
||||||
a.btn.btn-lg.btn-block.btn-primary.btn-link-social(href='/settings')
|
|
||||||
| Go back to Settings
|
|
||||||
|
|
||||||
script.
|
|
||||||
$(document).ready(function() {
|
|
||||||
$('form').submit(function(event){
|
|
||||||
event.preventDefault();
|
|
||||||
$('#flash-board').hide();
|
|
||||||
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')
|
|
||||||
.fadeIn();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.done(data =>{
|
|
||||||
if(data && data.message){
|
|
||||||
$('#flash-content').html(data.message);
|
|
||||||
$('#flash-board')
|
|
||||||
.removeClass('alert-info')
|
|
||||||
.addClass('alert-success')
|
|
||||||
.fadeIn();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
Reference in New Issue
Block a user