Created
August 7, 2013 18:52
-
-
Save brunotavares/6177250 to your computer and use it in GitHub Desktop.
Help with scenario: User clicks link to /users/:id/edit, but they must authenticate at /login before the page is visible. Ideas?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//app/controller/Base.js | |
Ext.define('SenchaCon.controller.Base',{ | |
extend: 'Ext.app.Controller', | |
/** | |
* If user already logged in, don't require login anymore. | |
* Otherwise, open the login modal. | |
*/ | |
requireLogin: function() { | |
if (User.isLoggedIn) { | |
return false; | |
} | |
this.render('loginpanel'); | |
return true; | |
} | |
}); | |
//app/controller/WhosHere | |
Ext.define('SenchaCon.controller.WhosHere',{ | |
extend: 'SenchaCon.controller.Base', | |
// ... | |
onBtnShowLocationsTap: function() { | |
if (this.requireLogin()) { | |
return; | |
} | |
this.render('whosherelocations'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment