Browse Source

DecryptPassword API

Dev
Janie 2 years ago
parent
commit
3f2445e962
  1. 42
      EuroTran/EasyBL.WEBAPP/ShowEasy/SignupService.cs
  2. 11
      EuroTran/WebApp/Controllers/SignupController.cs

42
EuroTran/EasyBL.WEBAPP/ShowEasy/SignupService.cs

@ -264,7 +264,7 @@ namespace EasyBL.WEBAPP.SYS
//}
srm = new SuccessResponseMessage(null, null);
srm.DATA.Add(BLWording.REL, Mailto.MemberID);
srm.DATA.Add(BLWording.REL, Mailto);
} while (false);
return srm;
@ -1114,6 +1114,46 @@ namespace EasyBL.WEBAPP.SYS
}
//DecryptPassword
public HttpResponseMessage DecryptPassword(string OrgID, string Account)
{
//string sMsg = null;
SuccessResponseMessage srm = null;
var db = SugarBase.GetIntance();
string sError = null;
try
{
do
{
var sUser = db.Queryable<SETB_CMS_Member>().Single(x => x.Account == Account && x.OrgID == OrgID);
var password = SecurityUtil.Decrypt(sUser.Password);
srm = new SuccessResponseMessage(null, null);
srm.DATA.Add(BLWording.REL, password);
} while (false);
}
catch (Exception ex)
{
sError = Util.GetLastExceptionMsg(ex);
}
finally
{
if (null != sError)
{
srm = new SuccessResponseMessage(null, null)
{
STATUSCODE = (int)StatusCodeEnum.TokenVerifyFailed,
MSG = sError
};
}
}
return HttpResponseExtension.ToJson(JsonConvert.SerializeObject(srm));
}
}
}

11
EuroTran/WebApp/Controllers/SignupController.cs

@ -16,7 +16,6 @@ namespace WebApp.Controllers
{
public class SignupController : ApiController
{
//使用者以信箱註冊(連結)
[HttpPost]
public HttpResponseMessage SignupWithEmail_Link([FromBody] SETB_CMS_Member dto)
@ -101,6 +100,7 @@ namespace WebApp.Controllers
}
//輸入新密碼
[HttpPost]
public HttpResponseMessage ResetPassword(string Email, string Password)
@ -110,5 +110,14 @@ namespace WebApp.Controllers
}
//解密
[HttpPost]
public HttpResponseMessage DecryptPassword(string OrgID, string Account)
{
return new SignupService().DecryptPassword(OrgID, Account);
}
}
}
Loading…
Cancel
Save