<commit_before>import Mode from '../../lock/mode';
import { initSocial } from '../../social/index';
import { getScreen, initDatabase } from '../../database/index';
import AskSocialNetworkOrLogin from '../../cred/or/ask_social_network_or_login';
import ResetPassword from '../../database/reset_password';
import SignUp from '../../database/sign_up';
import dict from './dict';

export default class SocialOrDatabaseMode extends Mode {

  constructor() {
    super("socialOrDatabase", dict);
  }

  didInitialize(model, options) {
    model = model.set("forceRedirect", !options.popup);
    model = initSocial(model, options);
    model = initDatabase(model, options);
    this.setModel(model);
  }

  render(lock) {
    const screen = getScreen(lock);
    switch(screen) {
      case "login":
      return new AskSocialNetworkOrLogin();

      case "signUp":
      return new SignUp();

      case "resetPassword":
      return new ResetPassword();

      default: // TODO: show a crashed screen.
      throw new Error("unknown screen");
    }
  }

}
<commit_msg>Add SSO screens for socialOrDatabase mode<commit_after>import Mode from '../../lock/mode';
import { initSocial } from '../../social/index';
import { getScreen, initDatabase } from '../../database/index';
import { renderSSOScreens } from '../../lock/sso/index';
import AskSocialNetworkOrLogin from '../../cred/or/ask_social_network_or_login';
import ResetPassword from '../../database/reset_password';
import SignUp from '../../database/sign_up';
import dict from './dict';

export default class SocialOrDatabaseMode extends Mode {

  constructor() {
    super("socialOrDatabase", dict);
  }

  didInitialize(model, options) {
    model = model.set("forceRedirect", !options.popup);
    model = initSocial(model, options);
    model = initDatabase(model, options);
    this.setModel(model);
  }

  render(lock) {
    const ssoScreen = renderSSOScreens(lock);
    if (ssoScreen) return ssoScreen;

    const screen = getScreen(lock);
    switch(screen) {
      case "login":
      return new AskSocialNetworkOrLogin();

      case "signUp":
      return new SignUp();

      case "resetPassword":
      return new ResetPassword();

      default: // TODO: show a crashed screen.
      throw new Error("unknown screen");
    }
  }

}

{'fraction_non_alphanumeric': 0.14391626689925863, 'fraction_numerical': 0.0, 'mean_word_length': 3.271880819366853, 'pattern_counts': {'":': 6, '<': 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': '3007920', 'n_tokens_mistral': 648, 'n_tokens_neox': 641, 'n_words': 176}