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,123 +1,123 @@
|
|
1
|
-
/**
|
2
|
-
@module ember-flexberry-account
|
3
|
-
*/
|
4
|
-
|
5
|
-
import Ember from 'ember';
|
6
|
-
|
7
|
-
export default Ember.Component.extend({
|
8
|
-
/**
|
9
|
-
Service that triggers user-account events.
|
10
|
-
|
11
|
-
@property userAccountService
|
12
|
-
@type {Class}
|
13
|
-
@default Ember.inject.service()
|
14
|
-
*/
|
15
|
-
userAccount: Ember.inject.service('user-account'),
|
16
|
-
|
17
|
-
useNavBlock: Ember.computed('showPwdResetButton', 'showRegButton', function() {
|
18
|
-
return this.get('showPwdResetButton') || this.get('showRegButton');
|
19
|
-
}),
|
20
|
-
|
21
|
-
/**
|
22
|
-
Stores if we gonna show registration button or not.
|
23
|
-
|
24
|
-
@property showRegButton
|
25
|
-
@type Boolean
|
26
|
-
@default false
|
27
|
-
*/
|
28
|
-
showRegButton: false,
|
29
|
-
|
30
|
-
/**
|
31
|
-
Stores if we gonna show login button or not.
|
32
|
-
|
33
|
-
@property showLoginButton
|
34
|
-
@type Boolean
|
35
|
-
@default false
|
36
|
-
*/
|
37
|
-
showLoginButton: false,
|
38
|
-
|
39
|
-
/**
|
40
|
-
This field stores username.
|
41
|
-
|
42
|
-
@property username
|
43
|
-
@type String
|
44
|
-
@default undefined
|
45
|
-
*/
|
46
|
-
username: undefined,
|
47
|
-
|
48
|
-
/**
|
49
|
-
This field shows if captcha was successfully passed.
|
50
|
-
|
51
|
-
@property captchaPassed
|
52
|
-
@type Boolean
|
53
|
-
@default false
|
54
|
-
*/
|
55
|
-
captchaPassed: false,
|
56
|
-
|
57
|
-
/**
|
58
|
-
This computed field shows whether password reset is allowed or not.
|
59
|
-
|
60
|
-
@property allowReset
|
61
|
-
@type Boolean
|
62
|
-
@default false
|
63
|
-
*/
|
64
|
-
allowReset: Ember.computed('username', function() {
|
65
|
-
return Ember.isEmpty(this.username);
|
66
|
-
}),
|
67
|
-
|
68
|
-
actions: {
|
69
|
-
|
70
|
-
/**
|
71
|
-
This action is called when captcha is successfully passed.
|
72
|
-
|
73
|
-
@method actions.captchaSuccess
|
74
|
-
*/
|
75
|
-
captchaSuccess: function() {
|
76
|
-
this.set('captchaPassed', true);
|
77
|
-
},
|
78
|
-
|
79
|
-
/**
|
80
|
-
This action is called when register button is pressed.
|
81
|
-
|
82
|
-
@method actions.register
|
83
|
-
*/
|
84
|
-
register: function() {
|
85
|
-
Ember.getOwner(this).lookup('router:main').transitionTo('register');
|
86
|
-
},
|
87
|
-
|
88
|
-
/**
|
89
|
-
This action is called when login button is pressed.
|
90
|
-
|
91
|
-
@method actions.login
|
92
|
-
*/
|
93
|
-
login: function() {
|
94
|
-
Ember.getOwner(this).lookup('router:main').transitionTo('login');
|
95
|
-
},
|
96
|
-
|
97
|
-
/**
|
98
|
-
This action is called when password reset button is pressed.
|
99
|
-
|
100
|
-
@method actions.pwdReset
|
101
|
-
*/
|
102
|
-
pwdReset: function() {
|
103
|
-
let username = this.get('username');
|
104
|
-
let userAccount = this.get('userAccount');
|
105
|
-
userAccount.pwdReset(username).then((result) => {
|
106
|
-
if (result) {
|
107
|
-
if (Ember.isPresent(this.get('onSuccess'))) {
|
108
|
-
this.get('onSuccess')();
|
109
|
-
}
|
110
|
-
} else {
|
111
|
-
if (Ember.isPresent(this.get('onFail'))) {
|
112
|
-
this.get('onFail')();
|
113
|
-
}
|
114
|
-
}
|
115
|
-
})
|
116
|
-
.catch((reason) => {
|
117
|
-
if (Ember.isPresent(this.get('onFail'))) {
|
118
|
-
this.get('onFail')(reason);
|
119
|
-
}
|
120
|
-
});
|
121
|
-
}
|
122
|
-
}
|
123
|
-
});
|
1
|
+
/**
|
2
|
+
@module ember-flexberry-account
|
3
|
+
*/
|
4
|
+
|
5
|
+
import Ember from 'ember';
|
6
|
+
|
7
|
+
export default Ember.Component.extend({
|
8
|
+
/**
|
9
|
+
Service that triggers user-account events.
|
10
|
+
|
11
|
+
@property userAccountService
|
12
|
+
@type {Class}
|
13
|
+
@default Ember.inject.service()
|
14
|
+
*/
|
15
|
+
userAccount: Ember.inject.service('user-account'),
|
16
|
+
|
17
|
+
useNavBlock: Ember.computed('showPwdResetButton', 'showRegButton', function() {
|
18
|
+
return this.get('showPwdResetButton') || this.get('showRegButton');
|
19
|
+
}),
|
20
|
+
|
21
|
+
/**
|
22
|
+
Stores if we gonna show registration button or not.
|
23
|
+
|
24
|
+
@property showRegButton
|
25
|
+
@type Boolean
|
26
|
+
@default false
|
27
|
+
*/
|
28
|
+
showRegButton: false,
|
29
|
+
|
30
|
+
/**
|
31
|
+
Stores if we gonna show login button or not.
|
32
|
+
|
33
|
+
@property showLoginButton
|
34
|
+
@type Boolean
|
35
|
+
@default false
|
36
|
+
*/
|
37
|
+
showLoginButton: false,
|
38
|
+
|
39
|
+
/**
|
40
|
+
This field stores username.
|
41
|
+
|
42
|
+
@property username
|
43
|
+
@type String
|
44
|
+
@default undefined
|
45
|
+
*/
|
46
|
+
username: undefined,
|
47
|
+
|
48
|
+
/**
|
49
|
+
This field shows if captcha was successfully passed.
|
50
|
+
|
51
|
+
@property captchaPassed
|
52
|
+
@type Boolean
|
53
|
+
@default false
|
54
|
+
*/
|
55
|
+
captchaPassed: false,
|
56
|
+
|
57
|
+
/**
|
58
|
+
This computed field shows whether password reset is allowed or not.
|
59
|
+
|
60
|
+
@property allowReset
|
61
|
+
@type Boolean
|
62
|
+
@default false
|
63
|
+
*/
|
64
|
+
allowReset: Ember.computed('username', function() {
|
65
|
+
return Ember.isEmpty(this.username);
|
66
|
+
}),
|
67
|
+
|
68
|
+
actions: {
|
69
|
+
|
70
|
+
/**
|
71
|
+
This action is called when captcha is successfully passed.
|
72
|
+
|
73
|
+
@method actions.captchaSuccess
|
74
|
+
*/
|
75
|
+
captchaSuccess: function() {
|
76
|
+
this.set('captchaPassed', true);
|
77
|
+
},
|
78
|
+
|
79
|
+
/**
|
80
|
+
This action is called when register button is pressed.
|
81
|
+
|
82
|
+
@method actions.register
|
83
|
+
*/
|
84
|
+
register: function() {
|
85
|
+
Ember.getOwner(this).lookup('router:main').transitionTo('register');
|
86
|
+
},
|
87
|
+
|
88
|
+
/**
|
89
|
+
This action is called when login button is pressed.
|
90
|
+
|
91
|
+
@method actions.login
|
92
|
+
*/
|
93
|
+
login: function() {
|
94
|
+
Ember.getOwner(this).lookup('router:main').transitionTo('login');
|
95
|
+
},
|
96
|
+
|
97
|
+
/**
|
98
|
+
This action is called when password reset button is pressed.
|
99
|
+
|
100
|
+
@method actions.pwdReset
|
101
|
+
*/
|
102
|
+
pwdReset: function() {
|
103
|
+
let username = this.get('username');
|
104
|
+
let userAccount = this.get('userAccount');
|
105
|
+
userAccount.pwdReset(username).then((result) => {
|
106
|
+
if (result) {
|
107
|
+
if (Ember.isPresent(this.get('onSuccess'))) {
|
108
|
+
this.get('onSuccess')();
|
109
|
+
}
|
110
|
+
} else {
|
111
|
+
if (Ember.isPresent(this.get('onFail'))) {
|
112
|
+
this.get('onFail')();
|
113
|
+
}
|
114
|
+
}
|
115
|
+
})
|
116
|
+
.catch((reason) => {
|
117
|
+
if (Ember.isPresent(this.get('onFail'))) {
|
118
|
+
this.get('onFail')(reason);
|
119
|
+
}
|
120
|
+
});
|
121
|
+
}
|
122
|
+
}
|
123
|
+
});
|
@@ -1,115 +1,115 @@
|
|
1
|
-
/**
|
2
|
-
@module ember-flexberry-account
|
3
|
-
*/
|
4
|
-
import Ember from 'ember';
|
5
|
-
|
6
|
-
const { getOwner } = Ember;
|
7
|
-
|
8
|
-
export default Ember.Component.extend({
|
9
|
-
|
10
|
-
/**
|
11
|
-
Component's CSS-classes names.
|
12
|
-
*/
|
13
|
-
|
14
|
-
classNames: ['flexberry-recaptcha'],
|
15
|
-
|
16
|
-
/**
|
17
|
-
Environment configuration.
|
18
|
-
|
19
|
-
@property appConfig
|
20
|
-
@type Object
|
21
|
-
@default undefined
|
22
|
-
*/
|
23
|
-
appConfig: undefined,
|
24
|
-
|
25
|
-
/**
|
26
|
-
ReCaptcha public (site) key. Obtained from env
|
27
|
-
|
28
|
-
@property sitekey
|
29
|
-
@type String
|
30
|
-
@default undefined
|
31
|
-
*/
|
32
|
-
sitekey: undefined,
|
33
|
-
|
34
|
-
/**
|
35
|
-
Tabindex for reCaptcha component.
|
36
|
-
*/
|
37
|
-
tabindex: Ember.computed.alias('tabIndex'),
|
38
|
-
|
39
|
-
/**
|
40
|
-
Renders ReCaptcha according to given properties.
|
41
|
-
*/
|
42
|
-
renderReCaptcha() {
|
43
|
-
if (Ember.isNone(window.grecaptcha)) {
|
44
|
-
Ember.run.later(() => {
|
45
|
-
this.renderReCaptcha();
|
46
|
-
}, 500);
|
47
|
-
} else {
|
48
|
-
let container = this.$()[0];
|
49
|
-
let properties = this.getProperties(
|
50
|
-
'sitekey',
|
51
|
-
'theme',
|
52
|
-
'type',
|
53
|
-
'size',
|
54
|
-
'tabindex'
|
55
|
-
);
|
56
|
-
let parameters = Ember.merge(properties, {
|
57
|
-
callback: this.get('successCallback').bind(this),
|
58
|
-
'expired-callback': this.get('expiredCallback').bind(this)
|
59
|
-
});
|
60
|
-
let widgetId = window.grecaptcha.render(container, parameters);
|
61
|
-
this.set('widgetId', widgetId);
|
62
|
-
this.set('ref', this);
|
63
|
-
}
|
64
|
-
},
|
65
|
-
|
66
|
-
/**
|
67
|
-
Resets ReCaptcha.
|
68
|
-
*/
|
69
|
-
resetReCaptcha() {
|
70
|
-
if (Ember.isPresent(this.get('widgetId'))) {
|
71
|
-
window.grecaptcha.reset(this.get('widgetId'));
|
72
|
-
}
|
73
|
-
},
|
74
|
-
|
75
|
-
/**
|
76
|
-
Allows to use onSuccess action.
|
77
|
-
*/
|
78
|
-
successCallback(reCaptchaResponse) {
|
79
|
-
let action = this.get('onSuccess');
|
80
|
-
if (Ember.isPresent(action) && typeof (action) === 'function') {
|
81
|
-
action(reCaptchaResponse);
|
82
|
-
}
|
83
|
-
},
|
84
|
-
|
85
|
-
/**
|
86
|
-
Allows to use onExpired action.
|
87
|
-
*/
|
88
|
-
expiredCallback() {
|
89
|
-
let action = this.get('onExpired');
|
90
|
-
if (Ember.isPresent(action) && typeof (action) === 'function') {
|
91
|
-
action();
|
92
|
-
} else {
|
93
|
-
this.resetReCaptcha();
|
94
|
-
}
|
95
|
-
},
|
96
|
-
|
97
|
-
/**
|
98
|
-
Initializes DOM-related component's properties.
|
99
|
-
*/
|
100
|
-
didInsertElement() {
|
101
|
-
this._super(...arguments);
|
102
|
-
|
103
|
-
// Import application config\environment.
|
104
|
-
let appConfig = getOwner(this).
|
105
|
-
if (!Ember.isNone(appConfig)) {
|
106
|
-
this.set('appConfig', appConfig);
|
107
|
-
}
|
108
|
-
|
109
|
-
this.set('sitekey', appConfig.recaptcha.siteKey);
|
110
|
-
|
111
|
-
Ember.run.next(() => {
|
112
|
-
this.renderReCaptcha();
|
113
|
-
});
|
114
|
-
}
|
115
|
-
});
|
1
|
+
/**
|
2
|
+
@module ember-flexberry-account
|
3
|
+
*/
|
4
|
+
import Ember from 'ember';
|
5
|
+
|
6
|
+
const { getOwner } = Ember;
|
7
|
+
|
8
|
+
export default Ember.Component.extend({
|
9
|
+
|
10
|
+
/**
|
11
|
+
Component's CSS-classes names.
|
12
|
+
*/
|
13
|
+
|
14
|
+
classNames: ['flexberry-recaptcha'],
|
15
|
+
|
16
|
+
/**
|
17
|
+
Environment configuration.
|
18
|
+
|
19
|
+
@property appConfig
|
20
|
+
@type Object
|
21
|
+
@default undefined
|
22
|
+
*/
|
23
|
+
appConfig: undefined,
|
24
|
+
|
25
|
+
/**
|
26
|
+
ReCaptcha public (site) key. Obtained from env
|
27
|
+
|
28
|
+
@property sitekey
|
29
|
+
@type String
|
30
|
+
@default undefined
|
31
|
+
*/
|
32
|
+
sitekey: undefined,
|
33
|
+
|
34
|
+
/**
|
35
|
+
Tabindex for reCaptcha component.
|
36
|
+
*/
|
37
|
+
tabindex: Ember.computed.alias('tabIndex'),
|
38
|
+
|
39
|
+
/**
|
40
|
+
Renders ReCaptcha according to given properties.
|
41
|
+
*/
|
42
|
+
renderReCaptcha() {
|
43
|
+
if (Ember.isNone(window.grecaptcha)) {
|
44
|
+
Ember.run.later(() => {
|
45
|
+
this.renderReCaptcha();
|
46
|
+
}, 500);
|
47
|
+
} else {
|
48
|
+
let container = this.$()[0];
|
49
|
+
let properties = this.getProperties(
|
50
|
+
'sitekey',
|
51
|
+
'theme',
|
52
|
+
'type',
|
53
|
+
'size',
|
54
|
+
'tabindex'
|
55
|
+
);
|
56
|
+
let parameters = Ember.merge(properties, {
|
57
|
+
callback: this.get('successCallback').bind(this),
|
58
|
+
'expired-callback': this.get('expiredCallback').bind(this)
|
59
|
+
});
|
60
|
+
let widgetId = window.grecaptcha.render(container, parameters);
|
61
|
+
this.set('widgetId', widgetId);
|
62
|
+
this.set('ref', this);
|
63
|
+
}
|
64
|
+
},
|
65
|
+
|
66
|
+
/**
|
67
|
+
Resets ReCaptcha.
|
68
|
+
*/
|
69
|
+
resetReCaptcha() {
|
70
|
+
if (Ember.isPresent(this.get('widgetId'))) {
|
71
|
+
window.grecaptcha.reset(this.get('widgetId'));
|
72
|
+
}
|
73
|
+
},
|
74
|
+
|
75
|
+
/**
|
76
|
+
Allows to use onSuccess action.
|
77
|
+
*/
|
78
|
+
successCallback(reCaptchaResponse) {
|
79
|
+
let action = this.get('onSuccess');
|
80
|
+
if (Ember.isPresent(action) && typeof (action) === 'function') {
|
81
|
+
action(reCaptchaResponse);
|
82
|
+
}
|
83
|
+
},
|
84
|
+
|
85
|
+
/**
|
86
|
+
Allows to use onExpired action.
|
87
|
+
*/
|
88
|
+
expiredCallback() {
|
89
|
+
let action = this.get('onExpired');
|
90
|
+
if (Ember.isPresent(action) && typeof (action) === 'function') {
|
91
|
+
action();
|
92
|
+
} else {
|
93
|
+
this.resetReCaptcha();
|
94
|
+
}
|
95
|
+
},
|
96
|
+
|
97
|
+
/**
|
98
|
+
Initializes DOM-related component's properties.
|
99
|
+
*/
|
100
|
+
didInsertElement() {
|
101
|
+
this._super(...arguments);
|
102
|
+
|
103
|
+
// Import application config\environment.
|
104
|
+
let appConfig = getOwner(this).resolveRegistration('config:environment');
|
105
|
+
if (!Ember.isNone(appConfig)) {
|
106
|
+
this.set('appConfig', appConfig);
|
107
|
+
}
|
108
|
+
|
109
|
+
this.set('sitekey', appConfig.recaptcha.siteKey);
|
110
|
+
|
111
|
+
Ember.run.next(() => {
|
112
|
+
this.renderReCaptcha();
|
113
|
+
});
|
114
|
+
}
|
115
|
+
});
|