<commit_before>import {
    USER_CHANGED,
    PASSWORD_CHANGED,
    LOGIN_USER_SUCCESS,
    LOGIN_USER_FAILED,
    LOADING_START,
    LOADING_END
} from '../actions/types';

const INITIAL_STATE = {
    userField: '',
    passwordField: '',
    error: '',
    loadingLogin: false
};

export default (state = INITIAL_STATE, action) => {
    switch (action.type) {
        case USER_CHANGED:
            return { ...state, userField: action.payload };
        case PASSWORD_CHANGED:
            return { ...state, passwordField: action.payload };
        case LOADING_START:
            return { ...state, loadingLogin: true, error: '' };
        case LOADING_END:
            return { ...state, loadingLogin: false };
        case LOGIN_USER_SUCCESS:
            return { ...state, error: "", userField: "", passwordField:  "", loadingLogin: false };
        case LOGIN_USER_FAILED:
            return { ...state, error: i18n.t('login_failed'), passwordField:  "", loadingLogin: false };
        default:
            return state;
    }
};<commit_msg>The reducer for the 'login' now returns the username to app-level state<commit_after>import {
    USER_CHANGED,
    PASSWORD_CHANGED,
    LOGIN_USER_SUCCESS,
    LOGIN_USER_FAILED,
    LOADING_START,
    LOADING_END
} from '../actions/types';

const INITIAL_STATE = {
    userField: '',
    passwordField: '',
    error: '',
    user: '',
    loadingLogin: false
};

export default (state = INITIAL_STATE, action) => {
    switch (action.type) {
        case USER_CHANGED:
            return { ...state, userField: action.payload };
        case PASSWORD_CHANGED:
            return { ...state, passwordField: action.payload };
        case LOADING_START:
            return { ...state, loadingLogin: true, error: "" };
        case LOADING_END:
            return { ...state, loadingLogin: false };
        case LOGIN_USER_SUCCESS:
            return { ...state, error: "", userField: "", passwordField:  "", user: action.payload, loadingLogin: false };
        case LOGIN_USER_FAILED:
            return { ...state, error: i18n.t('login_failed'), passwordField:  "", loadingLogin: false };
        default:
            return state;
    }
};
{'fraction_non_alphanumeric': 0.1259124087591241, 'fraction_numerical': 0.0018248175182481751, 'mean_word_length': 2.3429878048780486, 'pattern_counts': {'":': 0, '<': 3, '<?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': '6317420', 'n_tokens_mistral': 656, 'n_tokens_neox': 653, 'n_words': 152}