<commit_before>/** @module profile/router */
'use strict';

const express = require('express');
const router = express.Router();
const middleware = require('../middleware');
const config = require("../../config");
const mongoose = require('mongoose');
const User = mongoose.model('User');
const session = require('express-session');

//supported methods
router.all('/', middleware.supportedMethods('GET, POST, DELETE, OPTIONS'));

router.get('/', function(req, res, next) {
  if(!req.session.user) {
    res.status(302);
    res.redirect('/welcome');
  } else {
    res.status(200)
    res.render('profile',{user: req.session.user});<commit_msg>+ guest can’t access profile page<commit_after>/** @module profile/router */
'use strict';

const express = require('express');
const router = express.Router();
const middleware = require('../middleware');
const config = require("../../config");
const mongoose = require('mongoose');
const User = mongoose.model('User');
const session = require('express-session');

//supported methods
router.all('/', middleware.supportedMethods('GET, POST, DELETE, OPTIONS'));

router.get('/', function(req, res, next) {
  if(!req.session.user) {
    res.status(302);
    res.redirect('/welcome');
  } else {
    if (req.session.user.password === "") {
      //res.status(401);
      //res.redirect(req.get('referer'));
    } else {
      res.status(200)
      res.render('profile',{user: req.session.user});
    }
{'fraction_non_alphanumeric': 0.20013850415512466, 'fraction_numerical': 0.01038781163434903, 'mean_word_length': 4.293040293040293, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5737069', 'n_tokens_mistral': 445, 'n_tokens_neox': 437, 'n_words': 97}