code format
This commit is contained in:
parent
29046a3e07
commit
1264bf2cbd
1 changed files with 62 additions and 65 deletions
|
|
@ -21,6 +21,7 @@ namespace Yavsc.Controllers
|
||||||
WebConfigurationManager.AppSettings ["RegistrationMessage"];
|
WebConfigurationManager.AppSettings ["RegistrationMessage"];
|
||||||
|
|
||||||
string avatarDir = "~/avatars";
|
string avatarDir = "~/avatars";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the avatar dir.
|
/// Gets or sets the avatar dir.
|
||||||
/// This value is past to <c>Server.MapPath</c>,
|
/// This value is past to <c>Server.MapPath</c>,
|
||||||
|
|
@ -58,7 +59,8 @@ namespace Yavsc.Controllers
|
||||||
FormsAuthentication.SetAuthCookie (model.UserName, model.RememberMe);
|
FormsAuthentication.SetAuthCookie (model.UserName, model.RememberMe);
|
||||||
if (returnUrl != null)
|
if (returnUrl != null)
|
||||||
return Redirect (returnUrl);
|
return Redirect (returnUrl);
|
||||||
else return View ("Index");
|
else
|
||||||
|
return View ("Index");
|
||||||
} else {
|
} else {
|
||||||
ModelState.AddModelError ("UserName", "The user name or password provided is incorrect.");
|
ModelState.AddModelError ("UserName", "The user name or password provided is incorrect.");
|
||||||
}
|
}
|
||||||
|
|
@ -79,8 +81,7 @@ namespace Yavsc.Controllers
|
||||||
return View (model);
|
return View (model);
|
||||||
}
|
}
|
||||||
if (ModelState.IsValid) {
|
if (ModelState.IsValid) {
|
||||||
if (model.ConfirmPassword != model.Password)
|
if (model.ConfirmPassword != model.Password) {
|
||||||
{
|
|
||||||
ModelState.AddModelError ("ConfirmPassword", "Veuillez confirmer votre mot de passe");
|
ModelState.AddModelError ("ConfirmPassword", "Veuillez confirmer votre mot de passe");
|
||||||
return View (model);
|
return View (model);
|
||||||
}
|
}
|
||||||
|
|
@ -128,10 +129,8 @@ namespace Yavsc.Controllers
|
||||||
using (MailMessage msg = new MailMessage (
|
using (MailMessage msg = new MailMessage (
|
||||||
HomeController.Admail, user.Email,
|
HomeController.Admail, user.Email,
|
||||||
string.Format ("Validation de votre compte {0}", YavscHelpers.SiteName),
|
string.Format ("Validation de votre compte {0}", YavscHelpers.SiteName),
|
||||||
body))
|
body)) {
|
||||||
{
|
using (SmtpClient sc = new SmtpClient ()) {
|
||||||
using (SmtpClient sc = new SmtpClient())
|
|
||||||
{
|
|
||||||
sc.Send (msg);
|
sc.Send (msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -242,6 +241,7 @@ namespace Yavsc.Controllers
|
||||||
avuri = Request.Url.Scheme + "://" + Request.Url.Authority + "/" + avuri;
|
avuri = Request.Url.Scheme + "://" + Request.Url.Authority + "/" + avuri;
|
||||||
HttpContext.Profile.SetPropertyValue ("avatar", avuri);
|
HttpContext.Profile.SetPropertyValue ("avatar", avuri);
|
||||||
HttpContext.Profile.Save ();
|
HttpContext.Profile.Save ();
|
||||||
|
model.avatar = avuri;
|
||||||
} else
|
} else
|
||||||
ModelState.AddModelError ("Avatar",
|
ModelState.AddModelError ("Avatar",
|
||||||
string.Format ("Image type {0} is not supported (suported formats : {1})",
|
string.Format ("Image type {0} is not supported (suported formats : {1})",
|
||||||
|
|
@ -285,7 +285,6 @@ namespace Yavsc.Controllers
|
||||||
FormsAuthentication.SetAuthCookie (username, model.RememberMe);
|
FormsAuthentication.SetAuthCookie (username, model.RememberMe);
|
||||||
ViewData ["Message"] = "Profile enregistré, cookie modifié.";
|
ViewData ["Message"] = "Profile enregistré, cookie modifié.";
|
||||||
}
|
}
|
||||||
// HttpContext.Profile.SetPropertyValue("Avatar",Avatar);
|
|
||||||
return View (model);
|
return View (model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -305,15 +304,13 @@ namespace Yavsc.Controllers
|
||||||
if (u == null) {
|
if (u == null) {
|
||||||
ViewData ["Error"] =
|
ViewData ["Error"] =
|
||||||
string.Format ("Cet utilisateur n'existe pas ({0})", id);
|
string.Format ("Cet utilisateur n'existe pas ({0})", id);
|
||||||
}
|
} else if (u.ProviderUserKey.ToString () == key) {
|
||||||
else
|
|
||||||
if (u.ProviderUserKey.ToString () == key) {
|
|
||||||
u.IsApproved = true;
|
u.IsApproved = true;
|
||||||
Membership.UpdateUser (u);
|
Membership.UpdateUser (u);
|
||||||
ViewData ["Message"] =
|
ViewData ["Message"] =
|
||||||
string.Format ("La création de votre compte ({0}) est validée.", id);
|
string.Format ("La création de votre compte ({0}) est validée.", id);
|
||||||
}
|
} else
|
||||||
else ViewData["Error"] = "La clé utilisée pour valider ce compte est incorrecte";
|
ViewData ["Error"] = "La clé utilisée pour valider ce compte est incorrecte";
|
||||||
return View ();
|
return View ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue