mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-03-31 07:12:49 -04:00
Send sign out message directly
This commit is contained in:
parent
59f987e105
commit
d2052980c4
3 changed files with 5 additions and 10 deletions
app
|
@ -68,13 +68,6 @@ setUpBackboneMediator = ->
|
|||
Backbone.Mediator.addDefSchemas schemas for definition, schemas of definitionSchemas
|
||||
Backbone.Mediator.addChannelSchemas schemas for channel, schemas of channelSchemas
|
||||
Backbone.Mediator.setValidationEnabled document.location.href.search(/codecombat.com/) is -1
|
||||
if webkit?.messageHandlers
|
||||
window.iPadSubscriptions = 'application:error': true # We try to subscribe to this one before it's all set up, so just do it.
|
||||
originalPublish = Backbone.Mediator.publish
|
||||
Backbone.Mediator.publish = ->
|
||||
originalPublish.apply Backbone.Mediator, arguments
|
||||
if window.iPadSubscriptions[arguments[0]]
|
||||
webkit.messageHandlers.backboneEventHandler?.postMessage channel: arguments[0], event: serializeForIOS(arguments[1] ? {})
|
||||
|
||||
setUpMoment = ->
|
||||
{me} = require 'core/auth'
|
||||
|
|
|
@ -40,7 +40,7 @@ module.exports = class AccountSettingsView extends CocoView
|
|||
#- Form input callbacks
|
||||
onInputChanged: (e) ->
|
||||
$(e.target).addClass 'changed'
|
||||
if (JSON.stringify(document.getElementById('email1').className)).indexOf("changed") > -1 or (JSON.stringify(document.getElementById('password1').className)).indexOf("changed") > -1
|
||||
if (JSON.stringify(document.getElementById('email1').className)).indexOf("changed") > -1 or (JSON.stringify(document.getElementById('password1').className)).indexOf("changed") > -1
|
||||
$(e.target).removeClass 'changed'
|
||||
else
|
||||
@trigger 'input-changed'
|
||||
|
@ -69,7 +69,7 @@ module.exports = class AccountSettingsView extends CocoView
|
|||
#- Just copied from OptionsView, TODO refactor
|
||||
confirmAccountDeletion: ->
|
||||
forms.clearFormAlerts(@$el)
|
||||
myEmail = me.get 'email'
|
||||
myEmail = me.get 'email'
|
||||
email1 = document.getElementById('email1').value
|
||||
password1 = document.getElementById('password1').value
|
||||
if Boolean(email1) and email1 is myEmail
|
||||
|
@ -109,7 +109,7 @@ module.exports = class AccountSettingsView extends CocoView
|
|||
message = $.i18n.t('account_settings.wrong_password', defaultValue: 'Wrong Password.')
|
||||
err = [message: message, property: 'password1', formatted: true]
|
||||
forms.applyErrorsToForm(@$el, err)
|
||||
$('.nano').nanoScroller({scrollTo: @$el.find('.has-error')})
|
||||
$('.nano').nanoScroller({scrollTo: @$el.find('.has-error')})
|
||||
setTimeout callback, 100
|
||||
else
|
||||
message = $.i18n.t('account_settings.wrong_email', defaultValue: 'Wrong Email.')
|
||||
|
@ -129,6 +129,7 @@ module.exports = class AccountSettingsView extends CocoView
|
|||
type: 'success'
|
||||
layout: 'topCenter'
|
||||
_.delay ->
|
||||
window?.webkit?.messageHandlers?.notification?.postMessage(name: "signOut") if window.application.isIPadApp
|
||||
Backbone.Mediator.publish("auth:logging-out", {})
|
||||
window.tracker?.trackEvent 'Log Out', category:'Homepage' if @id is 'home-view'
|
||||
logoutUser($('#login-email').val())
|
||||
|
|
|
@ -50,6 +50,7 @@ module.exports = class RootView extends CocoView
|
|||
cache: false
|
||||
|
||||
logoutAccount: ->
|
||||
window?.webkit?.messageHandlers?.notification?.postMessage(name: "signOut") if window.application.isIPadApp
|
||||
Backbone.Mediator.publish("auth:logging-out", {})
|
||||
window.tracker?.trackEvent 'Log Out', category:'Homepage', ['Google Analytics'] if @id is 'home-view'
|
||||
logoutUser($('#login-email').val())
|
||||
|
|
Loading…
Add table
Reference in a new issue