/// <summary> /// Calls the MobileBanking web service operation Register /// </summary> public static string Register(string requestField) { //var response = new RegisterResponseBody(); try { var request = new RegisterRequestBody(); request.request = requestField; var response = _mBankingService.Register(requestField); Utilities.TraceInterface("VCB Mobile Banking Service", "Register", request); Utilities.TraceInterface("VCB Mobile Banking Service", "Register", response); Utilities.WriteLogReqRes("VCBMobileBankingService", "Register", requestField, response); return(response); } catch (Exception ex) { Logger.Log(Logger.Category.None, null, Logger.Severity.Fatal, Base.LOG_E_GENMSGNOMC, "Failed to serialize object (%s)", ex); Utilities.WriteToEventLog("VCB Mobile Banking Service", ex, "Register", 1, EventLogEntryType.Error); } return(string.Empty); }
public JsonResult Register(RegisterRequestBody body) { User user = new User(); ResponseTemplate response = null; if (user.CheckIfEmailExist(body.Email)) { response = new ResponseTemplate { Status = "400", Message = "There is an existing user with the given email." }; return(Json(response)); } string hash1 = SingletonObjects.Hasher.GenerateHash(Encoding.UTF8.GetBytes(body.Password)); string hash2 = SingletonObjects.Hasher.GenerateHash(Encoding.UTF8.GetBytes(body.ConfirmPassword)); if (!SingletonObjects.Hasher.CompareHash(hash1, hash2)) { response = new ResponseTemplate { Status = "400", Message = "Password does not match." }; return(Json(response)); } body.Password = hash1; user.Save(body); response = new ResponseTemplate { Status = "200", Message = "Success" }; Session.Add("User", user.UserGUID.ToString()); return(Json(response)); }