blob: 95a34c0cbe802324584716408a21ce8cb2f3db84 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
AT.prototype.atFormHelpers = {
hide: function(){
var state = this.state || AccountsTemplates.getState();
return state === "hide";
},
showTitle: function(next_state){
var state = next_state || this.state || AccountsTemplates.getState();
if (Meteor.userId() && state === "signIn")
return false;
return !!AccountsTemplates.texts.title[state];
},
showOauthServices: function(next_state){
var state = next_state || this.state || AccountsTemplates.getState();
if (!(state === "signIn" || state === "signUp"))
return false;
var services = AccountsTemplates.oauthServices();
if (!services.length)
return false;
if (Meteor.userId())
return AccountsTemplates.options.showAddRemoveServices;
return true;
},
showServicesSeparator: function(next_state){
var pwdService = Package["accounts-password"] !== undefined;
var state = next_state || this.state || AccountsTemplates.getState();
var rightState = (state === "signIn" || state === "signUp");
return rightState && !Meteor.userId() && pwdService && AccountsTemplates.oauthServices().length;
},
showError: function(next_state) {
return !!AccountsTemplates.state.form.get("error");
},
showResult: function(next_state) {
return !!AccountsTemplates.state.form.get("result");
},
showMessage: function(next_state) {
return !!AccountsTemplates.state.form.get("message");
},
showPwdForm: function(next_state) {
if (Package["accounts-password"] === undefined)
return false;
var state = next_state || this.state || AccountsTemplates.getState();
if ((state === "verifyEmail") || (state === "signIn" && Meteor.userId()))
return false;
return true;
},
showSignInLink: function(next_state){
if (AccountsTemplates.options.hideSignInLink)
return false;
var state = next_state || this.state || AccountsTemplates.getState();
if (AccountsTemplates.options.forbidClientAccountCreation && state === "forgotPwd")
return true;
return state === "signUp";
},
showSignUpLink: function(next_state){
if (AccountsTemplates.options.hideSignUpLink)
return false;
var state = next_state || this.state || AccountsTemplates.getState();
return ((state === "signIn" && !Meteor.userId()) || state === "forgotPwd") && !AccountsTemplates.options.forbidClientAccountCreation;
},
showTermsLink: function(next_state){
//TODO: Add privacyRoute and termsRoute as alternatives (the point of named routes is
// being able to change the url in one place only)
if (!!AccountsTemplates.options.privacyUrl || !!AccountsTemplates.options.termsUrl) {
var state = next_state || this.state || AccountsTemplates.getState();
if (state === "signUp" || state === "enrollAccount" ) {
return true;
}
}
/*
if (state === "signIn"){
var pwdService = Package["accounts-password"] !== undefined;
if (!pwdService)
return true;
}
*/
return false;
},
showResendVerificationEmailLink: function(){
var parentData = Template.currentData();
var state = (parentData && parentData.state) || AccountsTemplates.getState();
return (state === "signIn" || state === "forgotPwd") && AccountsTemplates.options.showResendVerificationEmailLink;
},
};
|