Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Pq.Statechart = SC.Statechart.create({
- rootState: SC.State.design({
- initialSubstate: 'loggedOut',
- loggedOut: SC.State.design({
- enterState: function() {
- Pq.getPath('loginPage.mainPane').append();
- },
- exitState: function(){
- Pq.getPath('loginPage.mainPane').remove();
- },
- authenticate: function(){
- var userName = Pq.getPath('loginController.userName');
- var password = Pq.getPath('loginController.password');
- SC.Request.postUrl('/auth/', {login: userName, password: password}).notify(this, 'didCompleteAuthentication').json().send();
- },
- didCompleteAuthentication: function(response){
- if (SC.ok(response)) {
- this.gotoState('loggedIn');
- } else {
- SC.AlertPane.error({message:'Неверные реквизиты доступа!',description:'Возможно, вы допустили опечатку. Попробуйте снова.',caption:'Ошибка авторизации'});
- }
- }
- }),
- loggedIn: SC.State.design({
- enterState: function() {
- Pq.getPath('mainPage.mainPane').append();
- }
- })
- }
Add Comment
Please, Sign In to add comment