<commit_before>/**
 * @module timed
 * @submodule timed-routes
 * @public
 */
import Route from "@ember/routing/route";
import { inject as service } from "@ember/service";
import AuthenticatedRouteMixin from "ember-simple-auth/mixins/authenticated-route-mixin";
import moment from "moment";

/**
 * The protected route
 *
 * @class ProtectedRoute
 * @extends Ember.Route
 * @uses EmberSimpleAuth.AuthenticatedRouteMixin
 * @public
 */
export default Route.extend(AuthenticatedRouteMixin, {
  session: service("session"),
  notify: service("notify"),
  autostartTour: service("autostart-tour"),
  tourManager: service("tour-manager"),
  routing: service("-routing"),
  media: service("media"),
  store: service(),
  ajax: service(),

  async model() {
    const user = await this.ajax.request("/api/v1/users/me", {
      method: "GET",
      data: {
        include: "supervisors,supervisees"
      }
    });

    await this.store.pushPayload("user", user);<commit_msg>fix(auth): Redirect to SSO if authentication fails<commit_after>/**
 * @module timed
 * @submodule timed-routes
 * @public
 */
import Route from "@ember/routing/route";
import { inject as service } from "@ember/service";
import AuthenticatedRouteMixin from "ember-simple-auth/mixins/authenticated-route-mixin";
import moment from "moment";

/**
 * The protected route
 *
 * @class ProtectedRoute
 * @extends Ember.Route
 * @uses EmberSimpleAuth.AuthenticatedRouteMixin
 * @public
 */
export default Route.extend(AuthenticatedRouteMixin, {
  session: service("session"),
  notify: service("notify"),
  autostartTour: service("autostart-tour"),
  tourManager: service("tour-manager"),
  routing: service("-routing"),
  media: service("media"),
  store: service(),
  ajax: service(),
  router: service(),

  async model() {
    let user;
    try {
      user = await this.ajax.request("/api/v1/users/me", {
        method: "GET",
        data: {
          include: "supervisors,supervisees"
        }
      });
    } catch (error) {
      this.router.transitionTo("login");
    }

    await this.store.pushPayload("user", user);
{'fraction_non_alphanumeric': 0.1485905398948877, 'fraction_numerical': 0.0009555661729574773, 'mean_word_length': 3.915492957746479, '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': '2604679', 'n_tokens_mistral': 652, 'n_tokens_neox': 641, 'n_words': 146}