Subversion Repositories SmartDukaan

Rev

Rev 20539 | Rev 20541 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
20427 kshitij.so 1
package com.hotspotstore.controllers;
2
 
20529 kshitij.so 3
import java.io.IOException;
4
 
20531 kshitij.so 5
import com.hotspotstore.services.SendGridMail;
20529 kshitij.so 6
import com.hotspotstore.services.VerifyRecaptcha;
20427 kshitij.so 7
 
8
 
9
public class ContactUsController extends BaseController{
10
 
11
	/**
12
	 * 
13
	 */
14
	private static final long serialVersionUID = 1L;
15
	private String result;
20531 kshitij.so 16
	private String name;
20539 kshitij.so 17
 
20531 kshitij.so 18
	public String getName() {
19
		return name;
20
	}
20427 kshitij.so 21
 
20531 kshitij.so 22
	public void setName(String name) {
23
		this.name = name;
24
	}
25
 
26
	public String getEmail() {
27
		return email;
28
	}
29
 
30
	public void setEmail(String email) {
31
		this.email = email;
32
	}
33
 
34
	public String getCity() {
35
		return city;
36
	}
37
 
38
	public void setCity(String city) {
39
		this.city = city;
40
	}
41
 
42
	public String getState() {
43
		return state;
44
	}
45
 
46
	public void setState(String state) {
47
		this.state = state;
48
	}
49
 
50
	public String getMobile() {
51
		return mobile;
52
	}
53
 
54
	public void setMobile(String mobile) {
55
		this.mobile = mobile;
56
	}
57
 
58
	public String getCategory() {
59
		return category;
60
	}
61
 
62
	public void setCategory(String category) {
63
		this.category = category;
64
	}
65
 
66
	public String getMsg() {
67
		return msg;
68
	}
69
 
70
	public void setMsg(String msg) {
71
		this.msg = msg;
72
	}
73
 
74
	private String email;
75
	private String city;
76
	private String state;
77
	private String mobile;
78
	private String category;
79
	private String msg;
80
 
20427 kshitij.so 81
	public String getResult() {
82
		return result;
83
	}
84
 
85
	public void setResult(String result) {
86
		this.result = result;
87
	}
88
 
89
	public String index(){
90
		return "index";
91
	}
20539 kshitij.so 92
 
20427 kshitij.so 93
	public String create(){
20529 kshitij.so 94
		try {
20530 kshitij.so 95
			String gRecaptchaResponse = request.getParameter("g-recaptcha-response");
20539 kshitij.so 96
			try{
97
				SendGridMail.sendMail();
98
			}
99
			catch(Exception e){
100
				addActionError("OOPS!!!We are unable to process your request.");
101
				return "index";
102
			}
20529 kshitij.so 103
			boolean verify = VerifyRecaptcha.verify(gRecaptchaResponse);
104
			if (verify){
20539 kshitij.so 105
				addActionMessage("Thank you, your query has been submitted.");
20540 kshitij.so 106
				return "index";
20529 kshitij.so 107
			}
20539 kshitij.so 108
			addActionError("Captcha verification failed.");
109
 
20529 kshitij.so 110
		} catch (IOException e) {
20535 kshitij.so 111
			System.out.println(e);
20539 kshitij.so 112
			addActionError("OOPS!!!We are unable to process your request.");
20529 kshitij.so 113
		}
20539 kshitij.so 114
		return "index";
115
 
20427 kshitij.so 116
	}
117
 
118
 
119
}