Forgot

\Modules\Api\User\Forgot

Methods

post

<?php public static function \Modules\Api\User\Forgot::post($login, $from = null, $signature = null)

Description
Sending a password generation link to the user by email.

Parameters

  • login
    User's login
  • from
    Sender of email (optional)
  • signature
    Signature at the end of message sent. (optional)

Return
Array : success or error message

{
  "success": {
    "message": "Request was successful",
    "key": "ok",
    "code": 200
  }
}

// or an error object like : 

{
  "error": {
    "message": "invalid_login",
    "key": "invalid_login",
    "code": 1
  }
}

Example

Here is a simple example of what your forgot webservice might look like.

<?php

namespace App\Modules\Users;

use \Lib\Controller\WSController;
use \Modules\Api\User\Forgot as ForgotController;

/**
 * Class Forgot
 * @package App\Modules\Users
 */
class Forgot extends \Modules\Elements
{


    /**
     * @description Generate a new password and send by mail.
     * @param WSController $controller
     * @param array $params
     * @return array
     * @throws \Lib\ApiException
     */
    public static function post(WSController $controller, $params = array())
    {

        $post = \Lib\DataRequest::getInstance()->get('post');

        return ForgotController::post($post['login']);
    }
}