<commit_before>/* globals module */

module.exports = function(data) {
    return {
        name: 'authentication',
        register(req, res) {
            let { username, password, firstName, lastName, email, phoneNumber } = req.body;
            data.createUser(username, password, firstName, lastName, email, phoneNumber)
                .then(() => {
                    return res.redirect('/sign-in');
                });
        },
        signOut(req, res) {
            req.logout();
            res.redirect('/');
        },
        getSignInForm(req, res) {
            return res.render('users/sign-in', {
                user: req.user
            });
        },
        getRegistrationForm(req, res) {
            return res.render('users/registration', {
                user: req.user
            });
        },
        getUserDetails(req, res) {
            return res.render('users/user-profile', {
                user: req.user
            });
        },
        getModifyProfileForm(res, req) {
            return res.render('users/modify-profile', {
                user: req.user
            });
        }
        // modifyProfile(req, res) {
        //     data.modifyUser(req.user, req.password, req.email, req.phoneNumber)
        //         .then(() => {
        //             return res.render('/modify-profile/:id');
        //         });
        // }
    };
};<commit_msg>user-controller fixed<commit_after>/* globals module */

module.exports = function(data) {
    return {
        name: 'authentication',
        register(req, res) {
            let { username, password, firstName, lastName, email, phoneNumber } = req.body;
            data.createUser(username, password, firstName, lastName, email, phoneNumber)
                .then(() => {
                    return res.redirect('/sign-in');
                });
        },
        signOut(req, res) {
            req.logout();
            res.redirect('/');
        },
        getSignInForm(req, res) {
            return res.render('users/sign-in', {
                user: req.user
            });
        },
        getRegistrationForm(req, res) {
            return res.render('users/registration', {
                user: req.user
            });
        },
        getModifyProfileForm(res, req) {
            return res.render('users/modify-profile', {
                user: req.user
            });
        },
        modifyProfile(req, res) {
            data.modifyUser(req.user, req.password, req.email, req.phoneNumber)
                .then(() => {
                    return res.render('/modify-profile/:id');
                });
        },
        getUserDetails(req, res) {
            return res.render('users/user-profile', {
                user: req.user
            });
        }
    };
};
{'fraction_non_alphanumeric': 0.13995001785076758, 'fraction_numerical': 0.0, 'mean_word_length': 1.3330557868442965, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5424618', 'n_tokens_mistral': 759, 'n_tokens_neox': 742, 'n_words': 129}