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.

94 lines
2.6 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.Web.Http;
  13. namespace WebApp.Controllers
  14. {
  15. public class SignupController : ApiController
  16. {
  17. //使用者以信箱註冊
  18. [HttpPost]
  19. public HttpResponseMessage SignupWithEmail([FromBody] SETB_CMS_Member dto)
  20. {
  21. return new SignupService().SignupWithEmail(dto);
  22. }
  23. //重新寄送認證信
  24. [HttpPost]
  25. public HttpResponseMessage ReSendVerifyMail(string Email)
  26. {
  27. return new SignupService().ReSendVerifyMail(Email);
  28. }
  29. //會員認證
  30. [HttpGet]
  31. public HttpResponseMessage VerifyAccount(string OrgID, string MemberID)
  32. {
  33. var result = new SignupService().VerifyAccount(OrgID, MemberID);
  34. var Server = Common.ConfigGetValue("", "ida:WebsiteUri");
  35. if (result.ReasonPhrase == "OK")
  36. {
  37. result = Request.CreateResponse(HttpStatusCode.Moved);
  38. result.Headers.Location = new Uri(Server);
  39. //result.Headers.Location = this.Request.RequestUri; //在API Header加入要導向的Location Url
  40. }
  41. return result;
  42. //return new SignupService().VerifyAccount(OrgID, MemberID);
  43. }
  44. //寄送忘記密碼信
  45. [HttpPost]
  46. public HttpResponseMessage SendForgotMail(string Email)
  47. {
  48. return new SignupService().SendForgotMail(Email);
  49. }
  50. //確認要修改密碼(導向修改密碼的頁面)
  51. [HttpGet]
  52. public HttpResponseMessage ResetPage(string Email)
  53. {
  54. var result = new SignupService().ResetPage(Email);
  55. var Server = Common.ConfigGetValue("", "ida:WebsiteUri");
  56. if (result.ReasonPhrase == "OK")
  57. {
  58. result = Request.CreateResponse(HttpStatusCode.Moved);
  59. result.Headers.Location = new Uri(Server + "/user/forgot"); //在API Header加入要導向的Location Url
  60. }
  61. return result;
  62. //return new SignupService().ResetPage(Email);
  63. }
  64. //輸入新密碼
  65. [HttpPost]
  66. public HttpResponseMessage ResetPassword(string Email, string Password)
  67. {
  68. return new SignupService().ResetPassword(Email, Password);
  69. }
  70. }
  71. }