aboutsummaryrefslogtreecommitdiffstats
path: root/core/lostpassword/ajaxcontroller.php
blob: 3722681308b569fe32a46af90006638679e7dccf (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
<?php
/**
 * @author Victor Dubiniuk
 * @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com
 *
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 * See the COPYING-README file.
 */
 
namespace OC\Core\LostPassword;

class AjaxController {
	public static function lost()	{
		\OCP\JSON::callCheck();
	
		try {
			Controller::sendEmail(@$_POST['user'], @$_POST['proceed']);
			\OCP\JSON::success();
		} catch (EncryptedDataException $e){
			\OCP\JSON::error(
				array('encryption' => '1')
			);
		} catch (\Exception $e){
			\OCP\JSON::error(
				array('msg'=> $e->getMessage())
			);
		}
		
		exit();
	}
	
	public static function resetPassword($args) {
		\OCP\JSON::callCheck();
		try {
			Controller::resetPassword($args);
			\OCP\JSON::success();
		} catch (Exception $e){
			\OCP\JSON::error(
				array('msg'=> $e->getMessage())
			);
		}
		exit();
	}
}