Skip to content

Instantly share code, notes, and snippets.

@brunotavares
Created August 7, 2013 18:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brunotavares/6177250 to your computer and use it in GitHub Desktop.
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?
//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