<commit_before>package net.inpercima.runandfun.web;

import static net.inpercima.runandfun.constants.AppConstants.SESSION_ACCESS_TOKEN;

import javax.servlet.http.HttpSession;

import net.inpercima.runandfun.constants.AppConstants;
import net.inpercima.runandfun.service.RunAndFunService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author <NAME>
 * @since 17.02.2015
 */
@Controller
public class ViewController {

    private static final String REDIRECT_TO_BASE = "redirect:/";

    @Autowired
    private RunAndFunService runAndFunService;

    @RequestMapping(value = "/verify")
    public String verify(final HttpSession session, @RequestParam(value = "code", required = true) final String code) {
        session.setAttribute(SESSION_ACCESS_TOKEN, runAndFunService.getAccessToken(code));
        return REDIRECT_TO_BASE;
    }

    @RequestMapping(value = "/indexActivities")
    public String indexActivities(final HttpSession session) {
        final String accessToken = (String) session.getAttribute(AppConstants.SESSION_ACCESS_TOKEN);
        runAndFunService.indexActivities(accessToken);
        return REDIRECT_TO_BASE;
    }

    @RequestMapping(value = "/logout")
    public String logout(final HttpSession session) {
        session.removeAttribute(SESSION_ACCESS_TOKEN);
        return REDIRECT_TO_BASE;
    }

}<commit_msg>invalidate session on logout<commit_after>package net.inpercima.runandfun.web;

import static net.inpercima.runandfun.constants.AppConstants.SESSION_ACCESS_TOKEN;

import javax.servlet.http.HttpSession;

import net.inpercima.runandfun.constants.AppConstants;
import net.inpercima.runandfun.service.RunAndFunService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author <NAME>
 * @since 17.02.2015
 */
@Controller
public class ViewController {

    private static final String REDIRECT_TO_BASE = "redirect:/";

    @Autowired
    private RunAndFunService runAndFunService;

    @RequestMapping(value = "/verify")
    public String verify(final HttpSession session, @RequestParam(value = "code", required = true) final String code) {
        session.setAttribute(SESSION_ACCESS_TOKEN, runAndFunService.getAccessToken(code));
        return REDIRECT_TO_BASE;
    }

    @RequestMapping(value = "/indexActivities")
    public String indexActivities(final HttpSession session) {
        final String accessToken = (String) session.getAttribute(AppConstants.SESSION_ACCESS_TOKEN);
        runAndFunService.indexActivities(accessToken);
        return REDIRECT_TO_BASE;
    }

    @RequestMapping(value = "/logout")
    public String logout(final HttpSession session) {
        session.invalidate();
        return REDIRECT_TO_BASE;
    }

}
{'fraction_non_alphanumeric': 0.09220779220779221, 'fraction_numerical': 0.005194805194805195, 'mean_word_length': 4.726765799256506, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6646054', 'n_tokens_mistral': 892, 'n_tokens_neox': 881, 'n_words': 163}