Subversion Repositories SmartDukaan

Rev

Rev 24383 | Rev 24478 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 24383 Rev 24417
Line 5... Line 5...
5
	});
5
	});
6
	$(".change-auth-user-password").live('click', function() {
6
	$(".change-auth-user-password").live('click', function() {
7
		console.log("change auth user password clicked......");
7
		console.log("change auth user password clicked......");
8
		loadChangeAuthUserPassword("main-content");
8
		loadChangeAuthUserPassword("main-content");
9
	});
9
	});
10
	
10
 
11
	$(".reset-password").live('click', function() {
11
	$(".reset-password")
-
 
12
			.live(
-
 
13
					'click',
-
 
14
					function() {
12
		console.log("reset-password clicked......");
15
						console.log("reset-password clicked......");
13
		var emailId=$(this).data('id');
16
						var emailId = $(this).data('id');
14
		console.log(emailId);
17
						console.log(emailId);
15
		if (confirm("Are you sure you want to reset password of Auth userEmail=!"+emailId) == true) {
18
						if (confirm("Are you sure you want to reset password of Auth userEmail=!"
-
 
19
								+ emailId) == true) {
16
		resetAuthUserPassword("main-content",emailId);
20
							resetAuthUserPassword("main-content", emailId);
17
		}
21
						}
18
	});
22
					});
19
	$(".change-password").live(
23
	$(".change-password")
-
 
24
			.live(
20
			'click',
25
					'click',
21
			function() {
26
					function() {
22
				console.log("change-password button clicked......");
27
						console.log("change-password button clicked......");
23
				var oldPassword = $("#currentPassword").val();
28
						var oldPassword = $("#currentPassword").val();
24
				var newPassword = $("#newPassword").val();
29
						var newPassword = $("#newPassword").val();
25
				var confirmPassword = $("#confirmPassword").val();
30
						var confirmPassword = $("#confirmPassword").val();
26
				if (oldPassword == "" || oldPassword == null
31
						if (oldPassword == "" || oldPassword == null
27
						|| oldPassword == undefined) {
32
								|| oldPassword == undefined) {
28
					alert("oldPassword cann't be blank");
33
							alert("oldPassword cann't be blank");
29
					return;
34
							return;
30
				}
35
						}
31
				if (newPassword == "" || newPassword == null
36
						if (newPassword == "" || newPassword == null
32
						|| newPassword == undefined) {
37
								|| newPassword == undefined) {
33
					alert("lastName cann't be blank");
38
							alert("lastName cann't be blank");
34
					return;
39
							return;
35
				}
40
						}
36
				if (confirmPassword == "" || confirmPassword == null
41
						if (confirmPassword == "" || confirmPassword == null
37
						|| confirmPassword == undefined) {
42
								|| confirmPassword == undefined) {
38
					alert("confirmPassword cann't be blank");
43
							alert("confirmPassword cann't be blank");
39
					return;
44
							return;
40
				}
45
						}
41
				if (confirmPassword == newPassword) {
46
						if (confirmPassword == newPassword) {
42
					if (confirm("Are you sure you want to change user password!") == true) {
47
							if (confirm("Are you sure you want to change user password!") == true) {
43
					changeAuthUserPassword(oldPassword,newPassword);
48
								changeAuthUserPassword(oldPassword, newPassword);
44
					}
49
							}
45
				} else {
50
						} else {
46
					alert("new Password and confirm Password must be match");
51
							alert("new Password and confirm Password must be match");
47
				}
52
						}
48
			});
53
					});
49
	$(".create-auth-user")
54
	$(".create-auth-user")
50
			.live(
55
			.live(
51
					'click',
56
					'click',
52
					function() {
57
					function() {
53
						console.log("Create Auth User button clicked......");
58
						console.log("Create Auth User button clicked......");
Line 88... Line 93...
88
						}
93
						}
89
					});
94
					});
90
	$("#authUsers-paginated .next").live(
95
	$("#authUsers-paginated .next").live(
91
			'click',
96
			'click',
92
			function() {
97
			function() {
93
				
98
 
94
					loadPaginatedNextItems('/getPaginatedAuthUser', null,
99
				loadPaginatedNextItems('/getPaginatedAuthUser', null,
95
							'authUsers-paginated', 'auth-user-table',
100
						'authUsers-paginated', 'auth-user-table',
96
							'auth-user-details-container');
101
						'auth-user-details-container');
97
				$(this).blur();
102
				$(this).blur();
98
			});
103
			});
99
 
104
 
100
	$("#authUsers-paginated .previous").live(
105
	$("#authUsers-paginated .previous").live(
101
			'click',
106
			'click',
102
			function() {
107
			function() {
103
				
108
 
104
				loadPaginatedPreviousItems('/getPaginatedAuthUser', null,
109
				loadPaginatedPreviousItems('/getPaginatedAuthUser', null,
105
							'authUsers-paginated', 'auth-user-table',
110
						'authUsers-paginated', 'auth-user-table',
106
							'auth-user-details-container');
111
						'auth-user-details-container');
107
				$(this).blur();
112
				$(this).blur();
108
			});
113
			});
109
 
114
 
110
});
115
});
111
 
116
 
Line 135... Line 140...
135
	doPostAjaxRequestWithParamsHandler(
140
	doPostAjaxRequestWithParamsHandler(
136
			context + "/createAuthUser",
141
			context + "/createAuthUser",
137
			params,
142
			params,
138
			function(response) {
143
			function(response) {
139
				alert("User successfully added! Password sent to registered email="
144
				alert("User successfully added! Password sent to registered email="
140
						+emailId);
145
						+ emailId);
141
				$('#' + "main-content").html(response);
146
				$('#' + "main-content").html(response);
142
			});
147
			});
143
}
148
}
144
function loadAddAuthUser(domId) {
149
function loadAddAuthUser(domId) {
145
	doGetAjaxRequestHandler(context + "/createAuthUser", function(response) {
150
	doGetAjaxRequestHandler(context + "/createAuthUser", function(response) {
146
		$('#' + domId).html(response);
151
		$('#' + domId).html(response);
147
	});
152
	});
148
}
153
}
149
function resetAuthUserPassword(domId,emailId)
154
function resetAuthUserPassword(domId, emailId) {
150
{
-
 
151
	var params={
155
	var params = {
152
			"emailId":emailId
156
		"emailId" : emailId
153
	}
157
	}
154
	doAjaxRequestWithParamsHandler(context + "/forgetPassword", "POST", params,
158
	doAjaxRequestWithParamsHandler(context + "/forgetPassword", "POST", params,
155
			function(response) {
159
			function(response) {
156
		if(response=="true")
160
				if (response == "true") {
157
			{
-
 
158
				alert("Password send to "+emailId+"  Successfully ");
161
					alert("Password send to " + emailId + "  Successfully ");
159
				loadAddAuthUser(domId);
162
					loadAddAuthUser(domId);
160
			}
163
				}
161
		
164
 
162
	});
165
			});
163
}
166
}
164
function validateEmail(emailField) {
167
function validateEmail(emailField) {
165
	var reg = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
168
	var reg = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
166
	if (reg.test(emailField) == false) {
169
	if (reg.test(emailField) == false) {
167
		alert('Invalid Email Address');
170
		alert('Invalid Email Address');