Subversion Repositories SmartDukaan

Rev

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

Rev 26785 Rev 26817
Line 37... Line 37...
37
	public boolean authenticate(String mobile, String password) {
37
	public boolean authenticate(String mobile, String password) {
38
		return customerRepository.authenticate(mobile, getHash256(password));
38
		return customerRepository.authenticate(mobile, getHash256(password));
39
	}
39
	}
40
 
40
 
41
	@Override
41
	@Override
42
	public void addCustomer(Customer customer) throws ProfitMandiBusinessException {
42
	public Customer addCustomer(Customer customer) {
43
		try {
43
		try {
44
			customerRepository.selectAllByMobileNumber(customer.getMobileNumber());
44
			customer = customerRepository.selectByMobileNumber(customer.getMobileNumber());
45
		} catch (ProfitMandiBusinessException pbse) {
45
		} catch (ProfitMandiBusinessException pbse) {
-
 
46
			customer.setPassword(getHash256(getRandomString()));
-
 
47
			try {
-
 
48
				customerRepository.persist(customer);
-
 
49
			} catch(Exception e) {
-
 
50
				e.printStackTrace();
46
			
51
			}
47
		}
52
		}
-
 
53
		return customer;
48
 
54
 
49
	}
55
	}
50
 
56
 
51
	private String getRandomString() {
57
	private String getRandomString() {
52
		int length = 10;
58
		int length = 10;