Commit cdcb10bf authored by Rafa Hernandez's avatar Rafa Hernandez Committed by Alexander Salas Bastidas

refactor(lostpassword): change method name to recovery and reset

parent 9a53edf3
......@@ -36,8 +36,8 @@ import org.glpi.api.query.GetAnItemQuery;
import org.glpi.api.query.GetSubItemQuery;
import org.glpi.api.request.ChangeActiveEntitiesRequest;
import org.glpi.api.request.ChangeActiveProfileRequest;
import org.glpi.api.request.LostPasswordRequest;
import org.glpi.api.request.RecoveryPasswordRequest;
import org.glpi.api.request.ResetPasswordRequest;
import org.glpi.api.response.InitSession;
import org.glpi.api.utils.Helpers;
......@@ -789,9 +789,9 @@ public class GLPI extends ServiceGenerator {
* @param email email address of the user to recover
* @param callback here your are going to get the asynchronous response
*/
public void lostPassword(String email, final VoidCallback callback) {
public void recoveryPassword(String email, final VoidCallback callback) {
LostPasswordRequest requestPost = new LostPasswordRequest(email);
RecoveryPasswordRequest requestPost = new RecoveryPasswordRequest(email);
Call<Void> responseCall = interfaces.lostPassword(requestPost);
responseCall.enqueue(new Callback<Void>() {
......@@ -824,9 +824,9 @@ public class GLPI extends ServiceGenerator {
* @param newPassword the new password for the user
* @param callback here your are going to get the asynchronous response
*/
public void recoveryPassword(String email, String token, String newPassword, final VoidCallback callback) {
public void resetPassword(String email, String token, String newPassword, final VoidCallback callback) {
RecoveryPasswordRequest requestPost = new RecoveryPasswordRequest(email, token, newPassword);
ResetPasswordRequest requestPost = new ResetPasswordRequest(email, token, newPassword);
Call<Void> responseCall = interfaces.recoveryPassword(requestPost);
responseCall.enqueue(new Callback<Void>() {
......
......@@ -30,8 +30,8 @@ import com.google.gson.JsonObject;
import org.glpi.api.request.ChangeActiveEntitiesRequest;
import org.glpi.api.request.ChangeActiveProfileRequest;
import org.glpi.api.request.LostPasswordRequest;
import org.glpi.api.request.RecoveryPasswordRequest;
import org.glpi.api.request.ResetPasswordRequest;
import org.glpi.api.response.InitSession;
import java.util.Map;
......@@ -125,10 +125,10 @@ public interface Routes {
@Headers("Content-Type: application/json")
@PUT("lostPassword")
Call<Void> lostPassword(@Body LostPasswordRequest requestPost);
Call<Void> lostPassword(@Body RecoveryPasswordRequest requestPost);
@Headers("Content-Type: application/json")
@PUT("lostPassword")
Call<Void> recoveryPassword(@Body RecoveryPasswordRequest requestPost);
Call<Void> recoveryPassword(@Body ResetPasswordRequest requestPost);
}
......@@ -32,26 +32,16 @@ public class RecoveryPasswordRequest {
@SerializedName("email")
private String email;
@SerializedName("password_forget_token")
private String passwordForgetToken;
@SerializedName("password")
private String password;
/**
* Create a request for Recovery Password
* Create a request for Lost Password
* @param email
* @param passwordForgetToken
* @param password
*/
public RecoveryPasswordRequest(String email, String passwordForgetToken, String password) {
public RecoveryPasswordRequest(String email) {
this.email = email;
this.passwordForgetToken = passwordForgetToken;
this.password = password;
}
/**
* get Email
* get email
* @return
*/
public String getEmail() {
......@@ -59,42 +49,10 @@ public class RecoveryPasswordRequest {
}
/**
* set Email
* set email
* @return
*/
public void setEmail(String email) {
this.email = email;
}
/**
* get Password Forget Token
* @return
*/
public String getPasswordForgetToken() {
return passwordForgetToken;
}
/**
* set Password Forget Token
* @return
*/
public void setPasswordForgetToken(String passwordForgetToken) {
this.passwordForgetToken = passwordForgetToken;
}
/**
* get Password
* @return
*/
public String getPassword() {
return password;
}
/**
* set Password
* @return
*/
public void setPassword(String password) {
this.password = password;
}
}
......@@ -27,21 +27,31 @@ package org.glpi.api.request;
import com.google.gson.annotations.SerializedName;
public class LostPasswordRequest {
public class ResetPasswordRequest {
@SerializedName("email")
private String email;
@SerializedName("password_forget_token")
private String passwordForgetToken;
@SerializedName("password")
private String password;
/**
* Create a request for Lost Password
* Create a request for Recovery Password
* @param email
* @param passwordForgetToken
* @param password
*/
public LostPasswordRequest(String email) {
public ResetPasswordRequest(String email, String passwordForgetToken, String password) {
this.email = email;
this.passwordForgetToken = passwordForgetToken;
this.password = password;
}
/**
* get email
* get Email
* @return
*/
public String getEmail() {
......@@ -49,10 +59,42 @@ public class LostPasswordRequest {
}
/**
* set email
* set Email
* @return
*/
public void setEmail(String email) {
this.email = email;
}
/**
* get Password Forget Token
* @return
*/
public String getPasswordForgetToken() {
return passwordForgetToken;
}
/**
* set Password Forget Token
* @return
*/
public void setPasswordForgetToken(String passwordForgetToken) {
this.passwordForgetToken = passwordForgetToken;
}
/**
* get Password
* @return
*/
public String getPassword() {
return password;
}
/**
* set Password
* @return
*/
public void setPassword(String password) {
this.password = password;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment