Skip to content

Commit

Permalink
Using proper route methods, escaping username in CurrentUserStore.
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisoelkers committed Mar 7, 2017
1 parent 860d82a commit ce490be
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions graylog2-web-interface/src/stores/users/CurrentUserStore.jsx
Expand Up @@ -2,17 +2,15 @@ import Reflux from 'reflux';

import URLUtils from 'util/URLUtils';
import fetch from 'logic/rest/FetchProvider';
import ApiRoutes from 'routing/ApiRoutes';

import StoreProvider from 'injection/StoreProvider';
const SessionStore = StoreProvider.getStore('Session');
const StartpageStore = StoreProvider.getStore('Startpage');
import CombinedProvider from 'injection/CombinedProvider';

import ActionsProvider from 'injection/ActionsProvider';
const SessionActions = ActionsProvider.getActions('Session');
const { SessionStore, SessionActions } = CombinedProvider.get('Session');
const { StartpageStore } = CombinedProvider.get('Startpage');

const CurrentUserStore = Reflux.createStore({
listenables: [SessionActions],
sourceUrl: '/users',
currentUser: undefined,

init() {
Expand Down Expand Up @@ -45,7 +43,7 @@ const CurrentUserStore = Reflux.createStore({
},

update(username) {
fetch('GET', URLUtils.qualifyUrl(this.sourceUrl + '/' + username))
fetch('GET', URLUtils.qualifyUrl(ApiRoutes.UsersApiController.load(encodeURIComponent(username)).url))
.then((resp) => {
this.currentUser = resp;
this.trigger({ currentUser: this.currentUser });
Expand Down

0 comments on commit ce490be

Please sign in to comment.