Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Internal server error when using this through jQuery AJAX.
- //
- // call:
- // $.ajax({
- // type: "post",
- // url: "api/signup.json",
- // contentType: "application/x-www-form-urlencoded;charset=UTF-8",
- // data: signupData, // serialized: username=ExampleUser&email=example%40example.tld&password=testpass
- // dataType: "json",
- // success: function(msg) {
- // if('error' in msg) {
- // alert(msg.error);
- // }else {
- // alert(msg.success);
- // }
- // },
- // statusCode: {
- // 404: function() {
- // alert('Kontakta webmastern då API:n ej verkar hittas!');
- // }
- // }
- // });
- public function post_signup() {
- $err = null;
- try {
- $ret = Auth::create_user(
- Input::post('username'),
- Input::post('password'),
- Input::post('email')
- );
- }catch(\SimpleUserUpdateException $e) {
- $err = $e;
- }
- if (null !== $err) {
- return $this->response(array(
- 'error' => $err
- ));
- } else {
- return $this->response(array(
- 'success' => $ret
- ));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement