Subversion Repositories SmartDukaan

Rev

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

Rev 34794 Rev 34815
Line 149... Line 149...
149
		return user;
149
		return user;
150
	}
150
	}
151
 
151
 
152
	@Override
152
	@Override
153
	public void resetPassword(String emailOrMobile) throws ProfitMandiBusinessException {
153
	public void resetPassword(String emailOrMobile) throws ProfitMandiBusinessException {
154
		User user = userRepository.selectByEmailIdOrMobileNumber(emailOrMobile);
154
		User user = userRepository.selectByEmailId(emailOrMobile);
155
		String password = getRandomString();
155
		String password = getRandomString();
156
		try {
156
		try {
157
			Utils.sendMailWithAttachments(mailSender, user.getEmailId(), null, RESET_PASSWORD_SUBJECT, String.format(RESET_PASSWORD_BODY, user.getFirstName(), password), null);
157
			Utils.sendMailWithAttachments(mailSender, user.getEmailId(), null, RESET_PASSWORD_SUBJECT, String.format(RESET_PASSWORD_BODY, user.getFirstName(), password), null);
158
		} catch (Exception e) {
158
		} catch (Exception e) {
159
			throw new ProfitMandiBusinessException("Password Reset Email", emailOrMobile, "Could not send password reset mail. Password Could not be reset");
159
			throw new ProfitMandiBusinessException("Password Reset Email", emailOrMobile, "Could not send password reset mail. Password Could not be reset");
Line 162... Line 162...
162
		authService.resetPassword(emailOrMobile, password);
162
		authService.resetPassword(emailOrMobile, password);
163
	}
163
	}
164
 
164
 
165
	@Override
165
	@Override
166
	public boolean resetPassword(String emailMobile, String password) throws ProfitMandiBusinessException {
166
	public boolean resetPassword(String emailMobile, String password) throws ProfitMandiBusinessException {
167
		User user = userRepository.selectByEmailIdOrMobileNumber(emailMobile);
167
		User user = userRepository.selectByEmailId(emailMobile);
168
		user.setPassword(encrypter.encrypt(password));
168
		user.setPassword(encrypter.encrypt(password));
169
		return true;
169
		return true;
170
	}
170
	}
171
 
171
 
172
	@Override
172
	@Override