You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123 lines
3.4 KiB

  1. using EasyBL;
  2. using EasyBL.WebApi.Filters;
  3. using EasyBL.WEBAPP.ShowEasy;
  4. using EasyBL.WEBAPP.SYS;
  5. using Entity.ShowEasyDtos;
  6. using Entity.Sugar;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Linq;
  10. using System.Net;
  11. using System.Net.Http;
  12. using System.Net.Http.Headers;
  13. using System.Web.Http;
  14. namespace WebApp.Controllers
  15. {
  16. public class SignupController : ApiController
  17. {
  18. //使用者以信箱註冊(連結)
  19. [HttpPost]
  20. public HttpResponseMessage SignupWithEmail_Link([FromBody] SETB_CMS_Member dto)
  21. {
  22. return new SignupService().SignupWithEmail_Link(dto);
  23. }
  24. //使用者以信箱註冊(認證碼)
  25. [HttpPost]
  26. public HttpResponseMessage SignupWithEmail([FromBody] SETB_CMS_Member dto)
  27. {
  28. return new SignupService().SignupWithEmail(dto);
  29. }
  30. //重新寄送認證信
  31. [HttpPost]
  32. public HttpResponseMessage ReSendVerifyMail(string Email)
  33. {
  34. return new SignupService().ReSendVerifyMail(Email);
  35. }
  36. //會員認證(連結)
  37. [HttpGet]
  38. public HttpResponseMessage VerifyAccount_Link(string OrgID, string MemberID)
  39. {
  40. var result = new SignupService().VerifyAccount_Link(OrgID, MemberID);
  41. var Server = Common.ConfigGetValue("", "ida:WebsiteUri");
  42. if (result.ReasonPhrase == "OK")
  43. {
  44. result = Request.CreateResponse(HttpStatusCode.Moved);
  45. result.Headers.Location = new Uri(Server);
  46. //result.Headers.Location = this.Request.RequestUri; //在API Header加入要導向的Location Url
  47. }
  48. return result;
  49. //return new SignupService().VerifyAccount(OrgID, MemberID);
  50. }
  51. //會員認證(認證碼)
  52. [HttpGet]
  53. public HttpResponseMessage VerifyAccount(string OrgID, string MemberID, string Code)
  54. {
  55. return new SignupService().VerifyAccount(OrgID, MemberID, Code);
  56. }
  57. //寄送忘記密碼信
  58. [HttpPost]
  59. public HttpResponseMessage SendForgotMail(string Email)
  60. {
  61. return new SignupService().SendForgotMail(Email);
  62. }
  63. //確認要修改密碼(導向修改密碼的頁面)
  64. [HttpGet]
  65. public HttpResponseMessage ResetPage(string Email)
  66. {
  67. var result = new SignupService().ResetPage(Email);
  68. var Server = Common.ConfigGetValue("", "ida:WebsiteUri");
  69. //var Server = "http://localhost:3000";
  70. if (result.ReasonPhrase == "OK")
  71. {
  72. result = Request.CreateResponse(HttpStatusCode.Moved);
  73. result.Headers.Location = new Uri(Server + "/user/forgot?Email=" + Email); //在API Header加入要導向的Location Url
  74. }
  75. return result;
  76. //return new SignupService().ResetPage(Email);
  77. }
  78. //輸入新密碼
  79. [HttpPost]
  80. public HttpResponseMessage ResetPassword(string Email, string Password)
  81. {
  82. return new SignupService().ResetPassword(Email, Password);
  83. }
  84. //解密
  85. [HttpPost]
  86. public HttpResponseMessage DecryptPassword(string OrgID, string Account)
  87. {
  88. return new SignupService().DecryptPassword(OrgID, Account);
  89. }
  90. }
  91. }