ember-flexberry-account 0.1.0-alpha.7 → 0.1.0-beta.1
Sign up to get free protection for your applications and to get access to all the features.
- package/.github/ISSUE_TEMPLATE/bug_report.md +58 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +46 -0
- package/.jscsrc +15 -15
- package/CHANGELOG.md +25 -17
- package/README.md +38 -38
- package/addon/components/flexberry-login.js +163 -158
- package/addon/components/flexberry-pwd-reset.js +123 -123
- package/addon/components/flexberry-recaptcha.js +115 -115
- package/addon/components/flexberry-register.js +226 -226
- package/addon/components/flexberry-user-profile.js +8 -8
- package/addon/controllers/email-confirmation.js +91 -91
- package/addon/controllers/login.js +4 -4
- package/addon/controllers/pwd-reset.js +4 -4
- package/addon/controllers/register.js +4 -4
- package/addon/controllers/user-profile.js +4 -4
- package/addon/locales/en/translations.js +63 -63
- package/addon/locales/ru/translations.js +65 -65
- package/addon/models/user-profile.js +5 -5
- package/addon/routes/email-confirmation.js +4 -4
- package/addon/routes/login.js +4 -4
- package/addon/routes/pwd-reset.js +4 -4
- package/addon/routes/reg-end.js +4 -4
- package/addon/routes/register.js +4 -4
- package/addon/routes/user-profile.js +4 -4
- package/addon/services/user-account.js +184 -184
- package/app/components/flexberry-login.js +1 -1
- package/app/components/flexberry-pwd-reset.js +1 -1
- package/app/components/flexberry-recaptcha.js +1 -1
- package/app/components/flexberry-register.js +1 -1
- package/app/components/flexberry-user-profile.js +1 -1
- package/app/controllers/email-confirmation.js +1 -1
- package/app/controllers/login.js +1 -1
- package/app/controllers/pwd-reset.js +1 -1
- package/app/controllers/register.js +1 -1
- package/app/controllers/user-profile.js +1 -1
- package/app/models/user-profile.js +1 -1
- package/app/routes/login.js +1 -1
- package/app/routes/pwd-reset.js +1 -1
- package/app/routes/register.js +1 -1
- package/app/routes/user-profile.js +1 -1
- package/app/services/user-account.js +82 -82
- package/app/templates/components/flexberry-login.hbs +53 -53
- package/app/templates/components/flexberry-pwd-reset.hbs +38 -38
- package/app/templates/components/flexberry-register.hbs +75 -75
- package/app/templates/components/flexberry-user-profile.hbs +1 -1
- package/app/templates/login.hbs +5 -5
- package/app/templates/pwd-reset.hbs +4 -4
- package/app/templates/register.hbs +4 -4
- package/app/templates/user-profile.hbs +3 -3
- package/blueprints/ember-flexberry-account/index.js +43 -43
- package/config/environment.js +6 -6
- package/index.js +6 -6
- package/package.json +1 -1
- package/scripts/deploy-to-gh-pages.sh +78 -78
- package/yarn.lock +7185 -0
- package/.npmignore +0 -16
- package/jsconfig.json +0 -1
- package/package-lock.json +0 -8894
- package/typings/ember/ember.d.ts +0 -3188
@@ -1,226 +1,226 @@
|
|
1
|
-
/**
|
2
|
-
@module ember-flexberry-account
|
3
|
-
*/
|
4
|
-
|
5
|
-
import Ember from 'ember';
|
6
|
-
|
7
|
-
export default Ember.Component.extend({
|
8
|
-
|
9
|
-
userAccount: Ember.inject.service('user-account'),
|
10
|
-
|
11
|
-
vk: false,
|
12
|
-
facebook: false,
|
13
|
-
twitter: false,
|
14
|
-
google: false,
|
15
|
-
microsoft: false,
|
16
|
-
github: false,
|
17
|
-
ok: false,
|
18
|
-
mailru: false,
|
19
|
-
yandex: false,
|
20
|
-
gosuslugi: false,
|
21
|
-
useSocialBlock: false,
|
22
|
-
|
23
|
-
useNavBlock: Ember.computed('showPwdResetButton', 'showRegButton', function() {
|
24
|
-
return this.get('showPwdResetButton') || this.get('showRegButton');
|
25
|
-
}),
|
26
|
-
|
27
|
-
/**
|
28
|
-
Stores if we gonna show login button or not.
|
29
|
-
|
30
|
-
@property showLoginButton
|
31
|
-
@type Boolean
|
32
|
-
@default false
|
33
|
-
*/
|
34
|
-
showLoginButton: false,
|
35
|
-
|
36
|
-
/**
|
37
|
-
Stores if we gonna show password reset button or not.
|
38
|
-
|
39
|
-
@property showPwdResetButton
|
40
|
-
@type Boolean
|
41
|
-
@default false
|
42
|
-
*/
|
43
|
-
showPwdResetButton: false,
|
44
|
-
|
45
|
-
/**
|
46
|
-
This field stores username.
|
47
|
-
|
48
|
-
@property username
|
49
|
-
@type String
|
50
|
-
@default undefined
|
51
|
-
*/
|
52
|
-
username: undefined,
|
53
|
-
|
54
|
-
/**
|
55
|
-
This field stores full name.
|
56
|
-
|
57
|
-
@property fullName
|
58
|
-
@type String
|
59
|
-
@default undefined
|
60
|
-
*/
|
61
|
-
fullName: undefined,
|
62
|
-
|
63
|
-
/**
|
64
|
-
Route to redirect after success registration.
|
65
|
-
|
66
|
-
@property goto
|
67
|
-
@type String
|
68
|
-
@default undefined
|
69
|
-
*/
|
70
|
-
goto: undefined,
|
71
|
-
|
72
|
-
/**
|
73
|
-
This field stores if username is valid.
|
74
|
-
|
75
|
-
@property validUsername
|
76
|
-
@type Boolean
|
77
|
-
@default false
|
78
|
-
*/
|
79
|
-
validUsername: false,
|
80
|
-
|
81
|
-
usernameFlag: undefined,
|
82
|
-
|
83
|
-
/**
|
84
|
-
This computed field shows whether fullname is valid or not.
|
85
|
-
|
86
|
-
@property validFullname
|
87
|
-
@type Boolean
|
88
|
-
@default false
|
89
|
-
*/
|
90
|
-
validFullname: Ember.computed('fullName', function() {
|
91
|
-
if (!Ember.isEmpty(this.get('fullName'))) {
|
92
|
-
return true;
|
93
|
-
} else {
|
94
|
-
return false;
|
95
|
-
}
|
96
|
-
}),
|
97
|
-
|
98
|
-
/**
|
99
|
-
This field stores if captcha is passed successfully.
|
100
|
-
|
101
|
-
@property captchaPassed
|
102
|
-
@type Boolean
|
103
|
-
@default false
|
104
|
-
*/
|
105
|
-
captchaPassed: false,
|
106
|
-
|
107
|
-
allowRegistration: Ember.computed(
|
108
|
-
'validUsername',
|
109
|
-
'validFullname',
|
110
|
-
function() { return !(this.get('validUsername') && this.get('validFullname'));}
|
111
|
-
),
|
112
|
-
|
113
|
-
actions: {
|
114
|
-
|
115
|
-
/**
|
116
|
-
This action is called when captcha is successfully passed.
|
117
|
-
|
118
|
-
@method actions.captchaSuccess
|
119
|
-
*/
|
120
|
-
captchaSuccess: function() {
|
121
|
-
this.set('captchaPassed', true);
|
122
|
-
},
|
123
|
-
|
124
|
-
/**
|
125
|
-
This action is called when username field is out of focus.
|
126
|
-
|
127
|
-
@method actions.validateUsername
|
128
|
-
*/
|
129
|
-
validateUsername: function() {
|
130
|
-
let username = this.get('username');
|
131
|
-
let userAccount = this.get('userAccount');
|
132
|
-
|
133
|
-
userAccount.validateUsername(username)
|
134
|
-
|
135
|
-
.then((result) => {
|
136
|
-
if (result) {
|
137
|
-
this.set('usernameFlag', '<i class="green check icon">');
|
138
|
-
} else {
|
139
|
-
this.set('usernameFlag', '<i class="red times icon">');
|
140
|
-
}
|
141
|
-
|
142
|
-
this.set('validUsername', result);
|
143
|
-
})
|
144
|
-
.catch(() => {
|
145
|
-
this.set('usernameFlag', '<i class="red times icon">');
|
146
|
-
this.set('validUsername', false);
|
147
|
-
});
|
148
|
-
},
|
149
|
-
|
150
|
-
/**
|
151
|
-
This action is called when register button is pressed.
|
152
|
-
|
153
|
-
@method actions.register
|
154
|
-
*/
|
155
|
-
register: function() {
|
156
|
-
let username = this.get('username');
|
157
|
-
let fullName = this.get('fullName');
|
158
|
-
let goto = this.get('goto');
|
159
|
-
let userAccount = this.get('userAccount');
|
160
|
-
userAccount.register(username, fullName, goto).then((result) => {
|
161
|
-
if (result) {
|
162
|
-
if (Ember.isPresent(this.get('onSuccess'))) {
|
163
|
-
this.get('onSuccess')();
|
164
|
-
}
|
165
|
-
} else {
|
166
|
-
if (Ember.isPresent(this.get('onFail'))) {
|
167
|
-
this.get('onFail')();
|
168
|
-
}
|
169
|
-
}
|
170
|
-
})
|
171
|
-
.catch((reason) => {
|
172
|
-
if (Ember.isPresent(this.get('onFail'))) {
|
173
|
-
this.get('onFail')(reason);
|
174
|
-
}
|
175
|
-
});
|
176
|
-
},
|
177
|
-
|
178
|
-
/**
|
179
|
-
This action is called when login button is pressed.
|
180
|
-
|
181
|
-
@method actions.login
|
182
|
-
*/
|
183
|
-
login: function() {
|
184
|
-
Ember.getOwner(this).lookup('router:main').transitionTo('login');
|
185
|
-
},
|
186
|
-
|
187
|
-
/**
|
188
|
-
This action is called when pwdReset button is pressed.
|
189
|
-
|
190
|
-
@method actions.pwdReset
|
191
|
-
*/
|
192
|
-
pwdReset: function() {
|
193
|
-
Ember.getOwner(this).lookup('router:main').transitionTo('pwd-reset');
|
194
|
-
}
|
195
|
-
},
|
196
|
-
|
197
|
-
/**
|
198
|
-
Initializes component.
|
199
|
-
*/
|
200
|
-
init: function() {
|
201
|
-
this._super(...arguments);
|
202
|
-
|
203
|
-
this.set('vk', this.get('userAccount.vk'));
|
204
|
-
this.set('facebook', this.get('userAccount.facebook'));
|
205
|
-
this.set('twitter', this.get('userAccount.twitter'));
|
206
|
-
this.set('google', this.get('userAccount.google'));
|
207
|
-
this.set('microsoft', this.get('userAccount.microsoft'));
|
208
|
-
this.set('github', this.get('userAccount.github'));
|
209
|
-
this.set('ok', this.get('userAccount.ok'));
|
210
|
-
this.set('mailru', this.get('userAccount.mailru'));
|
211
|
-
this.set('yandex', this.get('userAccount.yandex'));
|
212
|
-
this.set('gosuslugi', this.get('userAccount.gosuslugi'));
|
213
|
-
this.set('useSocialBlock', (
|
214
|
-
this.get('vk') ||
|
215
|
-
this.get('facebook') ||
|
216
|
-
this.get('twitter') ||
|
217
|
-
this.get('google') ||
|
218
|
-
this.get('microsoft') ||
|
219
|
-
this.get('github') ||
|
220
|
-
this.get('ok') ||
|
221
|
-
this.get('mailru') ||
|
222
|
-
this.get('yandex') ||
|
223
|
-
this.get('gosuslugi')
|
224
|
-
));
|
225
|
-
}
|
226
|
-
});
|
1
|
+
/**
|
2
|
+
@module ember-flexberry-account
|
3
|
+
*/
|
4
|
+
|
5
|
+
import Ember from 'ember';
|
6
|
+
|
7
|
+
export default Ember.Component.extend({
|
8
|
+
|
9
|
+
userAccount: Ember.inject.service('user-account'),
|
10
|
+
|
11
|
+
vk: false,
|
12
|
+
facebook: false,
|
13
|
+
twitter: false,
|
14
|
+
google: false,
|
15
|
+
microsoft: false,
|
16
|
+
github: false,
|
17
|
+
ok: false,
|
18
|
+
mailru: false,
|
19
|
+
yandex: false,
|
20
|
+
gosuslugi: false,
|
21
|
+
useSocialBlock: false,
|
22
|
+
|
23
|
+
useNavBlock: Ember.computed('showPwdResetButton', 'showRegButton', function() {
|
24
|
+
return this.get('showPwdResetButton') || this.get('showRegButton');
|
25
|
+
}),
|
26
|
+
|
27
|
+
/**
|
28
|
+
Stores if we gonna show login button or not.
|
29
|
+
|
30
|
+
@property showLoginButton
|
31
|
+
@type Boolean
|
32
|
+
@default false
|
33
|
+
*/
|
34
|
+
showLoginButton: false,
|
35
|
+
|
36
|
+
/**
|
37
|
+
Stores if we gonna show password reset button or not.
|
38
|
+
|
39
|
+
@property showPwdResetButton
|
40
|
+
@type Boolean
|
41
|
+
@default false
|
42
|
+
*/
|
43
|
+
showPwdResetButton: false,
|
44
|
+
|
45
|
+
/**
|
46
|
+
This field stores username.
|
47
|
+
|
48
|
+
@property username
|
49
|
+
@type String
|
50
|
+
@default undefined
|
51
|
+
*/
|
52
|
+
username: undefined,
|
53
|
+
|
54
|
+
/**
|
55
|
+
This field stores full name.
|
56
|
+
|
57
|
+
@property fullName
|
58
|
+
@type String
|
59
|
+
@default undefined
|
60
|
+
*/
|
61
|
+
fullName: undefined,
|
62
|
+
|
63
|
+
/**
|
64
|
+
Route to redirect after success registration.
|
65
|
+
|
66
|
+
@property goto
|
67
|
+
@type String
|
68
|
+
@default undefined
|
69
|
+
*/
|
70
|
+
goto: undefined,
|
71
|
+
|
72
|
+
/**
|
73
|
+
This field stores if username is valid.
|
74
|
+
|
75
|
+
@property validUsername
|
76
|
+
@type Boolean
|
77
|
+
@default false
|
78
|
+
*/
|
79
|
+
validUsername: false,
|
80
|
+
|
81
|
+
usernameFlag: undefined,
|
82
|
+
|
83
|
+
/**
|
84
|
+
This computed field shows whether fullname is valid or not.
|
85
|
+
|
86
|
+
@property validFullname
|
87
|
+
@type Boolean
|
88
|
+
@default false
|
89
|
+
*/
|
90
|
+
validFullname: Ember.computed('fullName', function() {
|
91
|
+
if (!Ember.isEmpty(this.get('fullName'))) {
|
92
|
+
return true;
|
93
|
+
} else {
|
94
|
+
return false;
|
95
|
+
}
|
96
|
+
}),
|
97
|
+
|
98
|
+
/**
|
99
|
+
This field stores if captcha is passed successfully.
|
100
|
+
|
101
|
+
@property captchaPassed
|
102
|
+
@type Boolean
|
103
|
+
@default false
|
104
|
+
*/
|
105
|
+
captchaPassed: false,
|
106
|
+
|
107
|
+
allowRegistration: Ember.computed(
|
108
|
+
'validUsername',
|
109
|
+
'validFullname',
|
110
|
+
function() { return !(this.get('validUsername') && this.get('validFullname'));}
|
111
|
+
),
|
112
|
+
|
113
|
+
actions: {
|
114
|
+
|
115
|
+
/**
|
116
|
+
This action is called when captcha is successfully passed.
|
117
|
+
|
118
|
+
@method actions.captchaSuccess
|
119
|
+
*/
|
120
|
+
captchaSuccess: function() {
|
121
|
+
this.set('captchaPassed', true);
|
122
|
+
},
|
123
|
+
|
124
|
+
/**
|
125
|
+
This action is called when username field is out of focus.
|
126
|
+
|
127
|
+
@method actions.validateUsername
|
128
|
+
*/
|
129
|
+
validateUsername: function() {
|
130
|
+
let username = this.get('username');
|
131
|
+
let userAccount = this.get('userAccount');
|
132
|
+
|
133
|
+
userAccount.validateUsername(username)
|
134
|
+
|
135
|
+
.then((result) => {
|
136
|
+
if (result) {
|
137
|
+
this.set('usernameFlag', '<i class="green check icon">');
|
138
|
+
} else {
|
139
|
+
this.set('usernameFlag', '<i class="red times icon">');
|
140
|
+
}
|
141
|
+
|
142
|
+
this.set('validUsername', result);
|
143
|
+
})
|
144
|
+
.catch(() => {
|
145
|
+
this.set('usernameFlag', '<i class="red times icon">');
|
146
|
+
this.set('validUsername', false);
|
147
|
+
});
|
148
|
+
},
|
149
|
+
|
150
|
+
/**
|
151
|
+
This action is called when register button is pressed.
|
152
|
+
|
153
|
+
@method actions.register
|
154
|
+
*/
|
155
|
+
register: function() {
|
156
|
+
let username = this.get('username');
|
157
|
+
let fullName = this.get('fullName');
|
158
|
+
let goto = this.get('goto');
|
159
|
+
let userAccount = this.get('userAccount');
|
160
|
+
userAccount.register(username, fullName, goto).then((result) => {
|
161
|
+
if (result) {
|
162
|
+
if (Ember.isPresent(this.get('onSuccess'))) {
|
163
|
+
this.get('onSuccess')();
|
164
|
+
}
|
165
|
+
} else {
|
166
|
+
if (Ember.isPresent(this.get('onFail'))) {
|
167
|
+
this.get('onFail')();
|
168
|
+
}
|
169
|
+
}
|
170
|
+
})
|
171
|
+
.catch((reason) => {
|
172
|
+
if (Ember.isPresent(this.get('onFail'))) {
|
173
|
+
this.get('onFail')(reason);
|
174
|
+
}
|
175
|
+
});
|
176
|
+
},
|
177
|
+
|
178
|
+
/**
|
179
|
+
This action is called when login button is pressed.
|
180
|
+
|
181
|
+
@method actions.login
|
182
|
+
*/
|
183
|
+
login: function() {
|
184
|
+
Ember.getOwner(this).lookup('router:main').transitionTo('login');
|
185
|
+
},
|
186
|
+
|
187
|
+
/**
|
188
|
+
This action is called when pwdReset button is pressed.
|
189
|
+
|
190
|
+
@method actions.pwdReset
|
191
|
+
*/
|
192
|
+
pwdReset: function() {
|
193
|
+
Ember.getOwner(this).lookup('router:main').transitionTo('pwd-reset');
|
194
|
+
}
|
195
|
+
},
|
196
|
+
|
197
|
+
/**
|
198
|
+
Initializes component.
|
199
|
+
*/
|
200
|
+
init: function() {
|
201
|
+
this._super(...arguments);
|
202
|
+
|
203
|
+
this.set('vk', this.get('userAccount.vk'));
|
204
|
+
this.set('facebook', this.get('userAccount.facebook'));
|
205
|
+
this.set('twitter', this.get('userAccount.twitter'));
|
206
|
+
this.set('google', this.get('userAccount.google'));
|
207
|
+
this.set('microsoft', this.get('userAccount.microsoft'));
|
208
|
+
this.set('github', this.get('userAccount.github'));
|
209
|
+
this.set('ok', this.get('userAccount.ok'));
|
210
|
+
this.set('mailru', this.get('userAccount.mailru'));
|
211
|
+
this.set('yandex', this.get('userAccount.yandex'));
|
212
|
+
this.set('gosuslugi', this.get('userAccount.gosuslugi'));
|
213
|
+
this.set('useSocialBlock', (
|
214
|
+
this.get('vk') ||
|
215
|
+
this.get('facebook') ||
|
216
|
+
this.get('twitter') ||
|
217
|
+
this.get('google') ||
|
218
|
+
this.get('microsoft') ||
|
219
|
+
this.get('github') ||
|
220
|
+
this.get('ok') ||
|
221
|
+
this.get('mailru') ||
|
222
|
+
this.get('yandex') ||
|
223
|
+
this.get('gosuslugi')
|
224
|
+
));
|
225
|
+
}
|
226
|
+
});
|
@@ -1,8 +1,8 @@
|
|
1
|
-
/**
|
2
|
-
@module ember-flexberry-account
|
3
|
-
*/
|
4
|
-
|
5
|
-
import Ember from 'ember';
|
6
|
-
|
7
|
-
export default Ember.Component.extend({
|
8
|
-
});
|
1
|
+
/**
|
2
|
+
@module ember-flexberry-account
|
3
|
+
*/
|
4
|
+
|
5
|
+
import Ember from 'ember';
|
6
|
+
|
7
|
+
export default Ember.Component.extend({
|
8
|
+
});
|
@@ -1,91 +1,91 @@
|
|
1
|
-
import Ember from 'ember';
|
2
|
-
|
3
|
-
export default Ember.Controller.extend({
|
4
|
-
|
5
|
-
userAccount: Ember.inject.service('user-account'),
|
6
|
-
|
7
|
-
/**
|
8
|
-
Defines which query parameters the controller accepts. [More info.](http://emberjs.com/api/classes/Ember.Controller.html#property_queryParams).
|
9
|
-
@property queryParams
|
10
|
-
@type Array
|
11
|
-
@default ['token', 'fwd']
|
12
|
-
*/
|
13
|
-
queryParams: ['token', 'fwd'],
|
14
|
-
|
15
|
-
/**
|
16
|
-
Activation token passed in query parameter.
|
17
|
-
@property token
|
18
|
-
@type String
|
19
|
-
@default null
|
20
|
-
*/
|
21
|
-
token: null,
|
22
|
-
/**
|
23
|
-
Route to transit to passed in query parameter.
|
24
|
-
@property fwd
|
25
|
-
@type String
|
26
|
-
@default null
|
27
|
-
*/
|
28
|
-
fwd: null,
|
29
|
-
|
30
|
-
/**
|
31
|
-
Flag indicates if activation button is enabled.
|
32
|
-
@property buttonEnabled
|
33
|
-
@type Boolean
|
34
|
-
@default true
|
35
|
-
*/
|
36
|
-
buttonEnabled: true,
|
37
|
-
|
38
|
-
/**
|
39
|
-
Flag indicates if there was an error while activating.
|
40
|
-
@property activationError
|
41
|
-
@type Boolean
|
42
|
-
@default false
|
43
|
-
*/
|
44
|
-
activationError: false,
|
45
|
-
|
46
|
-
/**
|
47
|
-
Flag indicates if there was an error while activating.
|
48
|
-
@property loaderEnabled
|
49
|
-
@type Boolean
|
50
|
-
@default false
|
51
|
-
*/
|
52
|
-
loaderEnabled: false,
|
53
|
-
|
54
|
-
actions: {
|
55
|
-
|
56
|
-
/**
|
57
|
-
This action is called when activation button is pressed.
|
58
|
-
|
59
|
-
@method actions.verify
|
60
|
-
*/
|
61
|
-
verify() {
|
62
|
-
this.set('buttonEnabled', false);
|
63
|
-
|
64
|
-
let token = this.get('token');
|
65
|
-
let fwd = this.get('fwd');
|
66
|
-
|
67
|
-
if (Ember.isEmpty(token)) {
|
68
|
-
this.set('activationError', true);
|
69
|
-
return;
|
70
|
-
}
|
71
|
-
|
72
|
-
let userAccount = this.get('userAccount');
|
73
|
-
|
74
|
-
userAccount.activateAccount(token)
|
75
|
-
.then(() => {
|
76
|
-
this.set('loaderEnabled', false);
|
77
|
-
|
78
|
-
if (fwd != null) {
|
79
|
-
this.transitionTo(fwd);
|
80
|
-
} else {
|
81
|
-
this.transitionTo('/');
|
82
|
-
}
|
83
|
-
|
84
|
-
})
|
85
|
-
.catch(() => {
|
86
|
-
this.set('loaderEnabled', false);
|
87
|
-
this.set('activationError', true);
|
88
|
-
});
|
89
|
-
}
|
90
|
-
}
|
91
|
-
});
|
1
|
+
import Ember from 'ember';
|
2
|
+
|
3
|
+
export default Ember.Controller.extend({
|
4
|
+
|
5
|
+
userAccount: Ember.inject.service('user-account'),
|
6
|
+
|
7
|
+
/**
|
8
|
+
Defines which query parameters the controller accepts. [More info.](http://emberjs.com/api/classes/Ember.Controller.html#property_queryParams).
|
9
|
+
@property queryParams
|
10
|
+
@type Array
|
11
|
+
@default ['token', 'fwd']
|
12
|
+
*/
|
13
|
+
queryParams: ['token', 'fwd'],
|
14
|
+
|
15
|
+
/**
|
16
|
+
Activation token passed in query parameter.
|
17
|
+
@property token
|
18
|
+
@type String
|
19
|
+
@default null
|
20
|
+
*/
|
21
|
+
token: null,
|
22
|
+
/**
|
23
|
+
Route to transit to passed in query parameter.
|
24
|
+
@property fwd
|
25
|
+
@type String
|
26
|
+
@default null
|
27
|
+
*/
|
28
|
+
fwd: null,
|
29
|
+
|
30
|
+
/**
|
31
|
+
Flag indicates if activation button is enabled.
|
32
|
+
@property buttonEnabled
|
33
|
+
@type Boolean
|
34
|
+
@default true
|
35
|
+
*/
|
36
|
+
buttonEnabled: true,
|
37
|
+
|
38
|
+
/**
|
39
|
+
Flag indicates if there was an error while activating.
|
40
|
+
@property activationError
|
41
|
+
@type Boolean
|
42
|
+
@default false
|
43
|
+
*/
|
44
|
+
activationError: false,
|
45
|
+
|
46
|
+
/**
|
47
|
+
Flag indicates if there was an error while activating.
|
48
|
+
@property loaderEnabled
|
49
|
+
@type Boolean
|
50
|
+
@default false
|
51
|
+
*/
|
52
|
+
loaderEnabled: false,
|
53
|
+
|
54
|
+
actions: {
|
55
|
+
|
56
|
+
/**
|
57
|
+
This action is called when activation button is pressed.
|
58
|
+
|
59
|
+
@method actions.verify
|
60
|
+
*/
|
61
|
+
verify() {
|
62
|
+
this.set('buttonEnabled', false);
|
63
|
+
|
64
|
+
let token = this.get('token');
|
65
|
+
let fwd = this.get('fwd');
|
66
|
+
|
67
|
+
if (Ember.isEmpty(token)) {
|
68
|
+
this.set('activationError', true);
|
69
|
+
return;
|
70
|
+
}
|
71
|
+
|
72
|
+
let userAccount = this.get('userAccount');
|
73
|
+
|
74
|
+
userAccount.activateAccount(token)
|
75
|
+
.then(() => {
|
76
|
+
this.set('loaderEnabled', false);
|
77
|
+
|
78
|
+
if (fwd != null) {
|
79
|
+
this.transitionTo(fwd);
|
80
|
+
} else {
|
81
|
+
this.transitionTo('/');
|
82
|
+
}
|
83
|
+
|
84
|
+
})
|
85
|
+
.catch(() => {
|
86
|
+
this.set('loaderEnabled', false);
|
87
|
+
this.set('activationError', true);
|
88
|
+
});
|
89
|
+
}
|
90
|
+
}
|
91
|
+
});
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import Ember from 'ember';
|
2
|
-
|
3
|
-
export default Ember.Controller.extend({
|
4
|
-
});
|
1
|
+
import Ember from 'ember';
|
2
|
+
|
3
|
+
export default Ember.Controller.extend({
|
4
|
+
});
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import Ember from 'ember';
|
2
|
-
|
3
|
-
export default Ember.Controller.extend({
|
4
|
-
});
|
1
|
+
import Ember from 'ember';
|
2
|
+
|
3
|
+
export default Ember.Controller.extend({
|
4
|
+
});
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import Ember from 'ember';
|
2
|
-
|
3
|
-
export default Ember.Controller.extend({
|
4
|
-
});
|
1
|
+
import Ember from 'ember';
|
2
|
+
|
3
|
+
export default Ember.Controller.extend({
|
4
|
+
});
|