merge from Yavsc
This commit is contained in:
commit
53325b7e6c
30 changed files with 243 additions and 546 deletions
|
|
@ -72,7 +72,7 @@ namespace Yavsc.ApiControllers
|
|||
break;
|
||||
case MembershipCreateStatus.Success:
|
||||
if (!model.IsApprouved)
|
||||
YavscHelpers.SendActivationMessage (user);
|
||||
Url.SendActivationMessage (user);
|
||||
ProfileBase prtu = ProfileBase.Create (model.UserName);
|
||||
prtu.SetPropertyValue("Name",model.Name);
|
||||
prtu.SetPropertyValue("Address",model.Address);
|
||||
|
|
@ -99,9 +99,12 @@ namespace Yavsc.ApiControllers
|
|||
public void ResetPassword(LostPasswordModel model)
|
||||
{
|
||||
StringDictionary errors;
|
||||
YavscHelpers.ResetPassword (model, out errors);
|
||||
MembershipUser user;
|
||||
YavscHelpers.ValidatePasswordReset (model, out errors, out user);
|
||||
foreach (string key in errors.Keys)
|
||||
ModelState.AddModelError (key, errors [key]);
|
||||
if (user != null && ModelState.IsValid)
|
||||
Url.SendActivationMessage (user);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ namespace Yavsc.ApiControllers
|
|||
try
|
||||
{
|
||||
// Read the form data.
|
||||
await Request.Content.ReadAsMultipartAsync(provider) ;
|
||||
IEnumerable<HttpContent> data = await Request.Content.ReadAsMultipartAsync(provider) ;
|
||||
|
||||
var invalidChars = Path.GetInvalidFileNameChars();
|
||||
List<string> bodies = new List<string>();
|
||||
|
|
@ -173,10 +173,8 @@ namespace Yavsc.ApiControllers
|
|||
foreach (string fkey in provider.BodyPartFileNames.Keys)
|
||||
{
|
||||
string filename = provider.BodyPartFileNames[fkey];
|
||||
|
||||
|
||||
string nicename=fkey;
|
||||
if (fkey.StartsWith("\"") && fkey.EndsWith("\"") && fkey.Length > 2)
|
||||
nicename = fkey.Substring(1,fkey.Length-2);
|
||||
var filtered = new string (nicename.Where( x=> !invalidChars.Contains(x)).ToArray());
|
||||
|
||||
FileInfo fi = new FileInfo(filtered);
|
||||
|
|
@ -184,6 +182,10 @@ namespace Yavsc.ApiControllers
|
|||
FileInfo fp = new FileInfo (Path.Combine(root,filename));
|
||||
if (fi.Exists) fi.Delete();
|
||||
fp.MoveTo(fi.FullName);
|
||||
// Get the mime type
|
||||
|
||||
|
||||
|
||||
using (Process p = new Process ()) {
|
||||
p.StartInfo.WorkingDirectory = root;
|
||||
p.StartInfo = new ProcessStartInfo ();
|
||||
|
|
@ -206,14 +208,14 @@ namespace Yavsc.ApiControllers
|
|||
);
|
||||
}
|
||||
}
|
||||
bodies.Add(fo.OpenText().ReadToEnd());
|
||||
parts.Add(fo.OpenText().ReadToEnd());
|
||||
|
||||
|
||||
fi.Delete();
|
||||
fo.Delete();
|
||||
}
|
||||
|
||||
return Request.CreateResponse(HttpStatusCode.OK,string.Join("---\n",bodies),new SimpleFormatter("text/plain"));
|
||||
return Request.CreateResponse(HttpStatusCode.OK,string.Join("---\n",parts),new SimpleFormatter("text/plain"));
|
||||
|
||||
}
|
||||
catch (System.Exception e)
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ using Yavsc.Helpers;
|
|||
using System.Web.Profile;
|
||||
using Yavsc.Model.Circles;
|
||||
using Yavsc.Model.Calendar;
|
||||
using System.Web.Http.Routing;
|
||||
|
||||
|
||||
namespace Yavsc.ApiControllers
|
||||
|
|
@ -160,7 +161,7 @@ namespace Yavsc.ApiControllers
|
|||
"déjà enregistré");
|
||||
break;
|
||||
case MembershipCreateStatus.Success:
|
||||
YavscHelpers.SendActivationMessage (user);
|
||||
Url.SendActivationMessage (user);
|
||||
// TODO set registration id
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,7 +85,8 @@ namespace Yavsc.ApiControllers
|
|||
return ;
|
||||
case MembershipCreateStatus.Success:
|
||||
if (!userModel.IsApprouved)
|
||||
YavscHelpers.SendActivationMessage (user);
|
||||
|
||||
Url.SendActivationMessage (user);
|
||||
return;
|
||||
default:
|
||||
throw new InvalidOperationException (string.Format("Unexpected user creation code :{0}",mcs));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue