2013-11-16 06:21:12 +08:00
|
|
|
|
2016-08-11 07:16:58 +08:00
|
|
|
import window from 'window';
|
|
|
|
import _ from '_';
|
|
|
|
import ko from 'ko';
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
import {
|
|
|
|
LoginSignMeType,
|
|
|
|
LoginSignMeTypeAsString,
|
|
|
|
ClientSideKeyName,
|
|
|
|
StorageResultType,
|
|
|
|
Magics,
|
|
|
|
Notification
|
|
|
|
} from 'Common/Enums';
|
|
|
|
|
|
|
|
import {
|
|
|
|
trim, inArray, pInt,
|
2016-09-03 07:19:37 +08:00
|
|
|
convertLangName, triggerAutocompleteInputChange
|
2016-08-17 06:01:20 +08:00
|
|
|
} from 'Common/Utils';
|
|
|
|
|
2016-09-29 05:40:17 +08:00
|
|
|
import {$win} from 'Common/Globals';
|
2016-08-17 06:01:20 +08:00
|
|
|
import {socialFacebook, socialGoogle, socialTwitter} from 'Common/Links';
|
|
|
|
import {getNotification, getNotificationFromResponse, reload as translatorReload} from 'Common/Translator';
|
|
|
|
|
|
|
|
import * as Plugins from 'Common/Plugins';
|
|
|
|
|
|
|
|
import AppStore from 'Stores/User/App';
|
|
|
|
import LanguageStore from 'Stores/Language';
|
|
|
|
|
|
|
|
import * as Settings from 'Storage/Settings';
|
|
|
|
import * as Local from 'Storage/Client';
|
|
|
|
|
|
|
|
import Remote from 'Remote/User/Ajax';
|
|
|
|
|
|
|
|
import {getApp} from 'Helper/Apps/User';
|
|
|
|
|
2016-09-03 07:19:37 +08:00
|
|
|
import {view, command, ViewType, routeOff, showScreenPopup} from 'Knoin/Knoin';
|
2016-08-17 06:01:20 +08:00
|
|
|
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
|
|
|
|
|
|
|
|
@view({
|
2016-09-16 04:34:30 +08:00
|
|
|
name: ['View/App/Login', 'View/User/Login'],
|
2016-08-17 06:01:20 +08:00
|
|
|
type: ViewType.Center,
|
|
|
|
templateID: 'Login'
|
|
|
|
})
|
|
|
|
class LoginUserView extends AbstractViewNext
|
2016-06-30 08:02:45 +08:00
|
|
|
{
|
2016-08-17 06:01:20 +08:00
|
|
|
constructor() {
|
|
|
|
super();
|
2014-08-21 23:08:34 +08:00
|
|
|
|
2016-09-29 05:40:17 +08:00
|
|
|
this.hideSubmitButton = !!Settings.appSettingsGet('hideSubmitButton');
|
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.welcome = ko.observable(!!Settings.settingsGet('UseLoginWelcomePage'));
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.email = ko.observable('');
|
|
|
|
this.password = ko.observable('');
|
|
|
|
this.signMe = ko.observable(false);
|
2014-04-06 03:48:22 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.additionalCode = ko.observable('');
|
|
|
|
this.additionalCode.error = ko.observable(false);
|
|
|
|
this.additionalCode.errorAnimation = ko.observable(false).extend({falseTimeout: 500});
|
|
|
|
this.additionalCode.focused = ko.observable(false);
|
|
|
|
this.additionalCode.visibility = ko.observable(false);
|
|
|
|
this.additionalCodeSignMe = ko.observable(false);
|
2015-06-01 01:40:54 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.logoImg = trim(Settings.settingsGet('LoginLogo'));
|
2016-09-29 05:40:17 +08:00
|
|
|
this.loginPowered = !!Settings.settingsGet('LoginPowered');
|
2016-08-17 06:01:20 +08:00
|
|
|
this.loginDescription = trim(Settings.settingsGet('LoginDescription'));
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.mobile = !!Settings.appSettingsGet('mobile');
|
|
|
|
this.mobileDevice = !!Settings.appSettingsGet('mobileDevice');
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.forgotPasswordLinkUrl = Settings.appSettingsGet('forgotPasswordLinkUrl');
|
|
|
|
this.registrationLinkUrl = Settings.appSettingsGet('registrationLinkUrl');
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.emailError = ko.observable(false);
|
|
|
|
this.passwordError = ko.observable(false);
|
2016-05-01 09:07:10 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.emailErrorAnimation = ko.observable(false).extend({falseTimeout: 500});
|
|
|
|
this.passwordErrorAnimation = ko.observable(false).extend({falseTimeout: 500});
|
2014-11-18 05:13:50 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.formHidden = ko.observable(false);
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.formError = ko.computed(
|
|
|
|
() => this.emailErrorAnimation() || this.passwordErrorAnimation() ||
|
|
|
|
(this.additionalCode.visibility() && this.additionalCode.errorAnimation())
|
|
|
|
);
|
2015-04-14 02:45:09 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.emailFocus = ko.observable(false);
|
|
|
|
this.passwordFocus = ko.observable(false);
|
2015-04-14 02:45:09 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.email.subscribe(() => {
|
|
|
|
this.emailError(false);
|
|
|
|
this.additionalCode('');
|
|
|
|
this.additionalCode.visibility(false);
|
|
|
|
});
|
2015-04-14 02:45:09 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.password.subscribe(() => {
|
|
|
|
this.passwordError(false);
|
|
|
|
});
|
2014-04-06 03:48:22 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.additionalCode.subscribe(() => {
|
|
|
|
this.additionalCode.error(false);
|
|
|
|
});
|
2014-04-06 03:48:22 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.additionalCode.visibility.subscribe(() => {
|
|
|
|
this.additionalCode.error(false);
|
|
|
|
});
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.emailError.subscribe((bV) => {
|
|
|
|
this.emailErrorAnimation(!!bV);
|
|
|
|
});
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.passwordError.subscribe((bV) => {
|
|
|
|
this.passwordErrorAnimation(!!bV);
|
|
|
|
});
|
2015-04-14 02:45:09 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.additionalCode.error.subscribe((bV) => {
|
|
|
|
this.additionalCode.errorAnimation(!!bV);
|
|
|
|
});
|
2015-04-14 02:45:09 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.submitRequest = ko.observable(false);
|
|
|
|
this.submitError = ko.observable('');
|
|
|
|
this.submitErrorAddidional = ko.observable('');
|
2015-04-14 02:45:09 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.submitError.subscribe((value) => {
|
|
|
|
if ('' === value)
|
|
|
|
{
|
|
|
|
this.submitErrorAddidional('');
|
|
|
|
}
|
|
|
|
});
|
2015-01-08 22:00:03 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.allowLanguagesOnLogin = AppStore.allowLanguagesOnLogin;
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.langRequest = ko.observable(false);
|
|
|
|
this.language = LanguageStore.language;
|
|
|
|
this.languages = LanguageStore.languages;
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.bSendLanguage = false;
|
2015-01-26 07:09:22 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.languageFullName = ko.computed(
|
|
|
|
() => convertLangName(this.language())
|
|
|
|
);
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.signMeType = ko.observable(LoginSignMeType.Unused);
|
2014-07-25 06:28:10 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.signMeType.subscribe((iValue) => {
|
|
|
|
this.signMe(LoginSignMeType.DefaultOn === iValue);
|
|
|
|
});
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.signMeVisibility = ko.computed(
|
|
|
|
() => LoginSignMeType.Unused !== this.signMeType()
|
|
|
|
);
|
2014-07-29 18:28:02 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.facebookLoginEnabled = ko.observable(false);
|
|
|
|
this.googleLoginEnabled = ko.observable(false);
|
|
|
|
this.googleFastLoginEnabled = ko.observable(false);
|
|
|
|
this.twitterLoginEnabled = ko.observable(false);
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.socialLoginEnabled = ko.computed(() => {
|
|
|
|
const
|
|
|
|
bF = this.facebookLoginEnabled(),
|
|
|
|
bG = this.googleLoginEnabled(),
|
|
|
|
bT = this.twitterLoginEnabled();
|
2014-07-25 06:28:10 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
return bF || bG || bT;
|
|
|
|
});
|
2013-12-09 23:16:58 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
if (Settings.settingsGet('AdditionalLoginError') && !this.submitError())
|
|
|
|
{
|
|
|
|
this.submitError(Settings.settingsGet('AdditionalLoginError'));
|
|
|
|
}
|
2016-09-03 07:19:37 +08:00
|
|
|
}
|
2016-09-02 04:41:36 +08:00
|
|
|
|
2016-12-15 05:56:17 +08:00
|
|
|
windowOpenFeatures(wh) {
|
|
|
|
return `left=200,top=100,width=${wh},height=${wh},menubar=no,status=no,resizable=yes,scrollbars=yes`;
|
|
|
|
}
|
|
|
|
|
2016-09-03 07:19:37 +08:00
|
|
|
@command((self) => !self.submitRequest() && self.facebookLoginEnabled())
|
|
|
|
facebookCommand() {
|
2016-12-15 05:56:17 +08:00
|
|
|
window.open(socialFacebook(), 'Facebook', this.windowOpenFeatures(500));
|
2016-09-03 07:19:37 +08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@command((self) => !self.submitRequest() && self.googleLoginEnabled())
|
|
|
|
googleCommand() {
|
2016-12-15 05:56:17 +08:00
|
|
|
window.open(socialGoogle(), 'Google', this.windowOpenFeatures(550));
|
2016-09-03 07:19:37 +08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@command((self) => !self.submitRequest() && self.googleFastLoginEnabled())
|
|
|
|
googleFastCommand() {
|
2016-12-15 05:56:17 +08:00
|
|
|
window.open(socialGoogle(true), 'Google', this.windowOpenFeatures(550));
|
2016-09-03 07:19:37 +08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@command((self) => !self.submitRequest() && self.twitterLoginEnabled())
|
|
|
|
twitterCommand() {
|
2016-12-15 05:56:17 +08:00
|
|
|
window.open(socialTwitter(), 'Twitter', this.windowOpenFeatures(500));
|
2016-09-03 07:19:37 +08:00
|
|
|
return true;
|
2016-09-02 04:41:36 +08:00
|
|
|
}
|
|
|
|
|
2016-09-03 07:19:37 +08:00
|
|
|
@command((self) => !self.submitRequest())
|
2016-09-02 04:41:36 +08:00
|
|
|
submitCommand() {
|
|
|
|
|
|
|
|
triggerAutocompleteInputChange();
|
|
|
|
|
|
|
|
this.emailError(false);
|
|
|
|
this.passwordError(false);
|
|
|
|
|
|
|
|
this.emailError('' === trim(this.email()));
|
|
|
|
this.passwordError('' === trim(this.password()));
|
|
|
|
|
|
|
|
if (this.additionalCode.visibility())
|
|
|
|
{
|
|
|
|
this.additionalCode.error(false);
|
|
|
|
this.additionalCode.error('' === trim(this.additionalCode()));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.emailError() || this.passwordError() ||
|
|
|
|
(this.additionalCode.visibility() && this.additionalCode.error()))
|
|
|
|
{
|
|
|
|
switch (true)
|
|
|
|
{
|
|
|
|
case this.emailError():
|
|
|
|
this.emailFocus(true);
|
|
|
|
break;
|
|
|
|
case this.passwordError():
|
|
|
|
this.passwordFocus(true);
|
|
|
|
break;
|
|
|
|
case this.additionalCode.visibility() && this.additionalCode.error():
|
|
|
|
this.additionalCode.focused(true);
|
|
|
|
break;
|
|
|
|
// no default
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
let
|
|
|
|
pluginResultCode = 0,
|
|
|
|
pluginResultMessage = '';
|
|
|
|
|
|
|
|
const
|
|
|
|
fSubmitResult = (iResultCode, sResultMessage) => {
|
|
|
|
pluginResultCode = iResultCode || 0;
|
|
|
|
pluginResultMessage = sResultMessage || '';
|
|
|
|
};
|
|
|
|
|
|
|
|
Plugins.runHook('user-login-submit', [fSubmitResult]);
|
|
|
|
if (0 < pluginResultCode)
|
|
|
|
{
|
|
|
|
this.submitError(getNotification(pluginResultCode));
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
else if ('' !== pluginResultMessage)
|
|
|
|
{
|
|
|
|
this.submitError(pluginResultMessage);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
this.submitRequest(true);
|
2016-09-29 05:40:17 +08:00
|
|
|
$win.trigger('rl.tooltips.diactivate');
|
2016-09-02 04:41:36 +08:00
|
|
|
|
|
|
|
const
|
|
|
|
fLoginRequest = (sLoginPassword) => {
|
|
|
|
|
2017-06-25 03:26:27 +08:00
|
|
|
Remote.login(
|
|
|
|
(sResult, oData) => {
|
2016-09-02 04:41:36 +08:00
|
|
|
|
2017-06-25 03:26:27 +08:00
|
|
|
$win.trigger('rl.tooltips.diactivate');
|
|
|
|
$win.trigger('rl.tooltips.activate');
|
2016-09-29 05:40:17 +08:00
|
|
|
|
2017-06-25 03:26:27 +08:00
|
|
|
if (StorageResultType.Success === sResult && oData && 'Login' === oData.Action)
|
2016-09-02 04:41:36 +08:00
|
|
|
{
|
2017-06-25 03:26:27 +08:00
|
|
|
if (oData.Result)
|
2016-09-02 04:41:36 +08:00
|
|
|
{
|
2017-06-25 03:26:27 +08:00
|
|
|
if (oData.TwoFactorAuth)
|
|
|
|
{
|
|
|
|
this.additionalCode('');
|
|
|
|
this.additionalCode.visibility(true);
|
|
|
|
this.submitRequest(false);
|
|
|
|
|
|
|
|
_.delay(() => this.additionalCode.focused(true), Magics.Time100ms);
|
|
|
|
}
|
|
|
|
else if (oData.Admin)
|
|
|
|
{
|
|
|
|
getApp().redirectToAdminPanel();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
getApp().loginAndLogoutReload(false);
|
|
|
|
}
|
2016-09-02 04:41:36 +08:00
|
|
|
}
|
2017-06-25 03:26:27 +08:00
|
|
|
else if (oData.ErrorCode)
|
2016-09-02 04:41:36 +08:00
|
|
|
{
|
2017-06-25 03:26:27 +08:00
|
|
|
this.submitRequest(false);
|
|
|
|
if (-1 < inArray(oData.ErrorCode, [Notification.InvalidInputArgument]))
|
|
|
|
{
|
|
|
|
oData.ErrorCode = Notification.AuthError;
|
|
|
|
}
|
|
|
|
|
|
|
|
this.submitError(getNotificationFromResponse(oData));
|
|
|
|
|
|
|
|
if ('' === this.submitError())
|
|
|
|
{
|
|
|
|
this.submitError(getNotification(Notification.UnknownError));
|
|
|
|
}
|
|
|
|
else if (oData.ErrorMessageAdditional)
|
|
|
|
{
|
|
|
|
this.submitErrorAddidional(oData.ErrorMessageAdditional);
|
|
|
|
}
|
2016-09-02 04:41:36 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-06-25 03:26:27 +08:00
|
|
|
this.submitRequest(false);
|
2016-09-02 04:41:36 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
this.submitRequest(false);
|
2017-06-25 03:26:27 +08:00
|
|
|
this.submitError(getNotification(Notification.UnknownError));
|
2016-09-02 04:41:36 +08:00
|
|
|
}
|
2017-06-25 03:26:27 +08:00
|
|
|
|
|
|
|
},
|
|
|
|
this.email(),
|
|
|
|
'',
|
|
|
|
sLoginPassword,
|
|
|
|
!!this.signMe(),
|
2016-09-02 04:41:36 +08:00
|
|
|
this.bSendLanguage ? this.language() : '',
|
|
|
|
this.additionalCode.visibility() ? this.additionalCode() : '',
|
|
|
|
this.additionalCode.visibility() ? !!this.additionalCodeSignMe() : false
|
|
|
|
);
|
|
|
|
|
|
|
|
Local.set(ClientSideKeyName.LastSignMe, this.signMe() ? '-1-' : '-0-');
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
fLoginRequest(this.password());
|
|
|
|
|
|
|
|
return true;
|
2016-06-30 08:02:45 +08:00
|
|
|
}
|
2016-08-17 06:01:20 +08:00
|
|
|
|
|
|
|
displayMainForm() {
|
|
|
|
this.welcome(false);
|
2016-06-30 08:02:45 +08:00
|
|
|
}
|
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
onShow() {
|
|
|
|
routeOff();
|
|
|
|
}
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
onShowWithDelay() {
|
|
|
|
if ('' !== this.email() && '' !== this.password())
|
|
|
|
{
|
2016-09-16 04:34:30 +08:00
|
|
|
this.passwordFocus(true);
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
|
|
|
else if ('' === this.email())
|
|
|
|
{
|
|
|
|
this.emailFocus(true);
|
|
|
|
}
|
|
|
|
else if ('' === this.password())
|
|
|
|
{
|
|
|
|
this.passwordFocus(true);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
this.emailFocus(true);
|
|
|
|
}
|
|
|
|
}
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
onHide() {
|
|
|
|
this.emailFocus(false);
|
|
|
|
this.passwordFocus(false);
|
|
|
|
}
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
onBuild() {
|
|
|
|
const
|
|
|
|
signMeLocal = Local.get(ClientSideKeyName.LastSignMe),
|
|
|
|
signMe = (Settings.settingsGet('SignMe') || 'unused').toLowerCase(),
|
|
|
|
jsHash = Settings.appSettingsGet('jsHash'),
|
|
|
|
fSocial = (iErrorCode) => {
|
|
|
|
iErrorCode = pInt(iErrorCode);
|
|
|
|
if (0 === iErrorCode)
|
|
|
|
{
|
|
|
|
this.submitRequest(true);
|
|
|
|
getApp().loginAndLogoutReload(false);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
this.submitError(getNotification(iErrorCode));
|
|
|
|
}
|
|
|
|
};
|
2014-08-21 23:08:34 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.facebookLoginEnabled(!!Settings.settingsGet('AllowFacebookSocial'));
|
|
|
|
this.twitterLoginEnabled(!!Settings.settingsGet('AllowTwitterSocial'));
|
2016-09-03 07:19:37 +08:00
|
|
|
this.googleLoginEnabled(!!Settings.settingsGet('AllowGoogleSocial') && !!Settings.settingsGet('AllowGoogleSocialAuth'));
|
|
|
|
this.googleFastLoginEnabled(!!Settings.settingsGet('AllowGoogleSocial') && !!Settings.settingsGet('AllowGoogleSocialAuthFast'));
|
2014-08-21 23:08:34 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
switch (signMe)
|
|
|
|
{
|
|
|
|
case LoginSignMeTypeAsString.DefaultOff:
|
|
|
|
case LoginSignMeTypeAsString.DefaultOn:
|
|
|
|
|
|
|
|
this.signMeType(LoginSignMeTypeAsString.DefaultOn === signMe ?
|
|
|
|
LoginSignMeType.DefaultOn : LoginSignMeType.DefaultOff);
|
|
|
|
|
|
|
|
switch (signMeLocal)
|
|
|
|
{
|
|
|
|
case '-1-':
|
|
|
|
this.signMeType(LoginSignMeType.DefaultOn);
|
|
|
|
break;
|
|
|
|
case '-0-':
|
|
|
|
this.signMeType(LoginSignMeType.DefaultOff);
|
|
|
|
break;
|
|
|
|
// no default
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
case LoginSignMeTypeAsString.Unused:
|
|
|
|
default:
|
|
|
|
this.signMeType(LoginSignMeType.Unused);
|
|
|
|
break;
|
|
|
|
}
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.email(AppStore.devEmail);
|
|
|
|
this.password(AppStore.devPassword);
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
if (this.googleLoginEnabled() || this.googleFastLoginEnabled())
|
|
|
|
{
|
|
|
|
window['rl_' + jsHash + '_google_login_service'] = fSocial;
|
|
|
|
}
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
if (this.facebookLoginEnabled())
|
|
|
|
{
|
|
|
|
window['rl_' + jsHash + '_facebook_login_service'] = fSocial;
|
|
|
|
}
|
2016-06-17 07:23:49 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
if (this.twitterLoginEnabled())
|
|
|
|
{
|
|
|
|
window['rl_' + jsHash + '_twitter_login_service'] = fSocial;
|
|
|
|
}
|
2014-09-06 05:44:29 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
_.delay(() => {
|
2014-09-06 05:44:29 +08:00
|
|
|
|
2016-08-22 05:30:34 +08:00
|
|
|
LanguageStore.language.subscribe((value) => {
|
2014-09-06 05:44:29 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.langRequest(true);
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2016-08-22 05:30:34 +08:00
|
|
|
translatorReload(false, value).then(() => {
|
2016-08-17 06:01:20 +08:00
|
|
|
this.langRequest(false);
|
|
|
|
this.bSendLanguage = true;
|
|
|
|
}, () => {
|
|
|
|
this.langRequest(false);
|
|
|
|
});
|
2016-06-30 08:02:45 +08:00
|
|
|
|
2014-08-21 23:08:34 +08:00
|
|
|
});
|
2016-06-17 07:23:49 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
}, Magics.Time50ms);
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
triggerAutocompleteInputChange(true);
|
|
|
|
}
|
2014-07-25 06:28:10 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
submitForm() {
|
|
|
|
this.submitCommand();
|
|
|
|
}
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
selectLanguage() {
|
|
|
|
showScreenPopup(require('View/Popup/Languages'), [
|
|
|
|
this.language, this.languages(), LanguageStore.userLanguage()
|
|
|
|
]);
|
|
|
|
}
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
selectLanguageOnTab(bShift) {
|
|
|
|
if (!bShift)
|
|
|
|
{
|
|
|
|
_.delay(() => {
|
|
|
|
this.emailFocus(true);
|
|
|
|
}, Magics.Time50ms);
|
2015-04-25 21:50:10 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
return false;
|
|
|
|
}
|
2015-04-25 21:50:10 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
2013-11-16 06:21:12 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
export {LoginUserView, LoginUserView as default};
|