* AccountController.cs: Register and reset passord

from Web API

* GCMController.cs: initial creation, will host GCM calls and related
  procedures.

* ResetPassword.aspx: Html view to reset the password

* LocalizedText.resx:
* LocalizedText.fr.resx: new String form circles

* Web.config:
* Web.csproj:
* YavscModel.csproj:
* LocalizedText.Designer.cs:
* Profile.cs:
* Profile.cs:
* LocalizedText.fr.Designer.cs:
* LoginModel.cs:
* Publishing.cs:
* CalendarController.cs:
* LoginModel.cs:
* GCMRegister.cs:
* Publishing.cs:
* GCMRegister.cs:
* NewRoleModel.cs:
* NewRoleModel.cs:
* RegisterModel.cs:
* NewAdminModel.cs:
* RegisterModel.cs:
* NewAdminModel.cs:
* LostPasswordModel.cs:
* RegisterViewModel.cs:
* RegisterViewModel.cs:
* ProviderPublicInfo.cs:
* RegisterClientModel.cs:
* ChangePasswordModel.cs:
* ProviderPublicInfo.cs:
* RegisterClientModel.cs:
* ChangePasswordModel.cs: Fixes a typo (in the namespace :-/)

* NpgsqlCircleProvider.cs: Fixes the Circle creation

* Global.asax.cs:
* AdminController.cs:
* NpgsqlContentProvider.cs: code formatting

* BlogsController.cs:
* CircleController.cs:
* WorkFlowController.cs:
* PaypalApiController.cs:
* FrontOfficeController.cs: refactoring

* AccountController.cs: Adds the way to reset the password

* FrontOfficeController.cs: xml doc

* T.cs: Make this class an helper to translation

* YavscHelpers.cs: Implements the e-mail sending

* style.css: style uniformization

* Circles.aspx: Implements the Html interface to Circle creation
  (modifications and deletions are still to implement)

* Register.ascx: Allows the error display in case of lack of power of
  the user at registering another user.

* Estimate.aspx: use the partial view to register from the Account
  folder.
Cleans the useless reference to ~/Theme/dark/style.css, that was for
  using the "tablesorter.js", no used anymore.

* Web.config: Trying to have all the Index pages to work...
This commit is contained in:
Paul Schneider 2015-06-18 11:02:23 +02:00
commit 53930befd3
44 changed files with 705 additions and 135 deletions

View file

@ -0,0 +1,41 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace Yavsc.Model.RolesAndMembers
{
/// <summary>
/// Change password model.
/// </summary>
public class ChangePasswordModel
{
/// <summary>
/// Gets or sets the username.
/// </summary>
/// <value>The username.</value>
[Required(ErrorMessage = "Please, enter your user name")]
public string Username { get; set; }
/// <summary>
/// Gets or sets the old password.
/// </summary>
/// <value>The old password.</value>
[Required(ErrorMessage = "Please, enter your old Password")]
public string OldPassword { get; set; }
/// <summary>
/// Gets or sets the new password.
/// </summary>
/// <value>The new password.</value>
[Required(ErrorMessage = "Please enter a new Password")]
public string NewPassword { get; set; }
/// <summary>
/// Gets or sets the confirm password.
/// </summary>
/// <value>The confirm password.</value>
[Required(ErrorMessage = "Please confirm the new Password")]
public string ConfirmPassword { get; set; }
}
}

View file

@ -0,0 +1,34 @@
//
// GCMRegister.cs
//
// Author:
// Paul Schneider <paul@pschneider.fr>
//
// Copyright (c) 2015 GNU GPL
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
namespace Yavsc.Model.RolesAndMembers
{
public class GCMRegister: RegisterModel
{
public GCMRegister ()
{
}
public string GCMRegistrationId { get; set; }
}
}

View file

@ -0,0 +1,37 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;
namespace Yavsc.Model.RolesAndMembers
{
/// <summary>
/// Login model.
/// </summary>
public class LoginModel
{
/// <summary>
/// Gets or sets the name of the user.
/// </summary>
/// <value>The name of the user.</value>
[DisplayName("Nom d'utilisateur"),
Required(ErrorMessage = "S'il vous plait, entrez un nom d'utilisateur ([a-z]|[A-Z]|[-_.~]|[0-9])+"),
RegularExpression("([a-z]|[A-Z]|[-_.~]|[0-9])+")]
public string UserName { get; set; }
/// <summary>
/// Gets or sets the password.
/// </summary>
/// <value>The password.</value>
[DisplayName("Mot de passe"),
Required(ErrorMessage = "S'il vous plait, entez un mot de passe"),
RegularExpression("([a-z]|[A-Z]|[0-9]|[-_.~#{}`'\\^])+")]
public string Password { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this <see cref="Yavsc.Model.RolesAndMembers.LoginModel"/> remember me.
/// </summary>
/// <value><c>true</c> if remember me; otherwise, <c>false</c>.</value>
[Display(Name = "Remember_me",ResourceType=typeof(LocalizedText))]
public bool RememberMe { get; set; }
}
}

View file

@ -0,0 +1,31 @@
//
// LostPasswordModel.cs
//
// Author:
// Paul Schneider <paul@pschneider.fr>
//
// Copyright (c) 2015 GNU GPL
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
namespace Yavsc.Model.RolesAndMembers
{
public class LostPasswordModel
{
public string UserName { get; set; }
public string Email { get; set; }
}
}

View file

@ -0,0 +1,20 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace Yavsc.Model.RolesAndMembers
{
/// <summary>
/// New admin model.
/// </summary>
public class NewAdminModel
{
/// <summary>
/// Gets or sets the name of the user about to become Admin.
/// </summary>
/// <value>The name of the user.</value>
[Required(ErrorMessage = "S'il vous plait, entrez un nom d'utilisateur"),
Display(Name = "Nom du nouvel administrateur", Description="Nom de l'utilisateur à enregistrer comme administrateur")]
public string UserName { get; set ; }
}
}

View file

@ -0,0 +1,22 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;
namespace Yavsc.Model.RolesAndMembers
{
/// <summary>
/// New role model.
/// </summary>
public class NewRoleModel
{
/// <summary>
/// Gets or sets the name of the role.
/// </summary>
/// <value>The name of the role.</value>
[Required]
[StringLength(255)]
[DisplayName("Nom du rôle")]
public string RoleName { get; set; }
}
}

View file

@ -0,0 +1,296 @@
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Web.Profile;
using System.Web.Security;
using System.Web;
using System.Configuration;
namespace Yavsc.Model.RolesAndMembers
{
/// <summary>
/// Profile.
/// </summary>
public class Profile
{
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
[DisplayName ("Nom complet")]
[StringLength (1024)]
public string Name { get; set; }
/// <summary>
/// Gets or sets the avatar.
/// </summary>
/// <value>The avatar.</value>
[DisplayName("Avatar")]
public string avatar { get; set; }
/// <summary>
/// Gets or sets the address.
/// </summary>
/// <value>The address.</value>
[DisplayName ("Adresse")]
[StringLength (2047)]
public string Address { get; set; }
/// <summary>
/// Gets or sets the state of the city and.
/// </summary>
/// <value>The state of the city and.</value>
[DisplayName ("Ville")]
[StringLength (255)]
public string CityAndState { get; set; }
/// <summary>
/// Gets or sets the zip code.
/// </summary>
/// <value>The zip code.</value>
[DisplayName ("Code Postal")]
[StringLength (9)]
public string ZipCode { get; set; }
/// <summary>
/// Gets or sets the country.
/// </summary>
/// <value>The country.</value>
[DisplayName ("Pays")]
[StringLength (99)]
public string Country { get; set; }
/// <summary>
/// Gets or sets the web site.
/// </summary>
/// <value>The web site.</value>
[DisplayName ("Site Web")]
[StringLength (255)]
public string WebSite { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this <see cref="Yavsc.Model.RolesAndMembers.Profile"/> blog visible.
/// </summary>
/// <value><c>true</c> if blog visible; otherwise, <c>false</c>.</value>
[DisplayName ("Blog visible")]
public bool BlogVisible { get; set; }
private string blogTitle;
/// <summary>
/// Gets or sets the blog title.
/// </summary>
/// <value>The blog title.</value>
[DisplayName ("Titre du blog")]
[StringLength (255)]
public string BlogTitle { get {
return string.IsNullOrWhiteSpace(blogTitle)?
(string.IsNullOrWhiteSpace(Name)?
UserName:Name)+"'s blog":blogTitle; }
set { blogTitle = value; } }
/// <summary>
/// Gets or sets the phone number.
/// </summary>
/// <value>The phone.</value>
[DisplayName ("Téléphone fixe")]
[StringLength (15)]
public string Phone { get; set; }
/// <summary>
/// Gets or sets the mobile.
/// </summary>
/// <value>The mobile.</value>
[DisplayName ("Portable")]
[StringLength (15)]
public string Mobile { get; set; }
/// <summary>
/// Gets or sets the BI.
/// </summary>
/// <value>The BI.</value>
[DisplayName ("Code BIC")]
[StringLength (15)]
public string BIC { get; set; }
/// <summary>
/// Gets or sets the IBA.
/// </summary>
/// <value>The IBA.</value>
[DisplayName ("Code IBAN")]
[StringLength (33)]
public string IBAN { get; set; }
/// <summary>
/// Gets or sets the bank code.
/// </summary>
/// <value>The bank code.</value>
[DisplayName ("Code Banque")]
[StringLength (5)]
public string BankCode { get; set; }
/// <summary>
/// Gets or sets the wicket code.
/// </summary>
/// <value>The wicket code.</value>
[DisplayName ("Code Guichet")]
[StringLength (5)]
public string WicketCode { get; set; }
/// <summary>
/// Gets or sets the account number.
/// </summary>
/// <value>The account number.</value>
[DisplayName ("Numéro de compte")]
[StringLength (15)]
public string AccountNumber { get; set; }
/// <summary>
/// Gets or sets the banked key.
/// </summary>
/// <value>The banked key.</value>
[DisplayName ("Clé RIB")]
public int BankedKey { get; set; }
/// <summary>
/// Gets or sets the google calendar.
/// </summary>
/// <value>The google calendar.</value>
[Display(Name="Google_calendar",ResourceType=typeof(LocalizedText))]
public string GoogleCalendar { get; set; }
/// <summary>
/// Gets a value indicating whether this instance has bank account.
/// </summary>
/// <value><c>true</c> if this instance has bank account; otherwise, <c>false</c>.</value>
public bool HasBankAccount {
get {
return !(
(
string.IsNullOrWhiteSpace (BankCode)
|| string.IsNullOrWhiteSpace (WicketCode)
|| string.IsNullOrWhiteSpace (AccountNumber)
|| BankedKey == 0
)
&&
( string.IsNullOrWhiteSpace (BIC)
|| string.IsNullOrWhiteSpace (IBAN))
); } }
/// <summary>
/// Gets a value indicating whether this instance has postal address.
/// </summary>
/// <value><c>true</c> if this instance has postal address; otherwise, <c>false</c>.</value>
public bool HasPostalAddress {
get {
return !string.IsNullOrWhiteSpace (Address)
&& !string.IsNullOrWhiteSpace (CityAndState)
&& !string.IsNullOrWhiteSpace (ZipCode);
}
}
/// <summary>
/// Gets a value indicating whether this instance is billable.
/// Returns true when
/// Name is not null and all of
/// Address, CityAndState and ZipCode are not null,
/// or one of Email or Phone or Mobile is not null
///
/// </summary>
/// <value><c>true</c> if this instance is billable; otherwise, <c>false</c>.</value>
public bool IsBillable {
get {
// true if has a name and, either a postal address, an email, or a Mobile phone number
// Name is not null and
// (
// (Address and CityAndState and ZipCode)
// or Email or Phone or Mobile
// )
return !string.IsNullOrWhiteSpace (Name)
&& !( (string.IsNullOrWhiteSpace (Address)
|| string.IsNullOrWhiteSpace (CityAndState)
|| string.IsNullOrWhiteSpace (ZipCode))
&& string.IsNullOrWhiteSpace (Phone)
&& string.IsNullOrWhiteSpace (Mobile));
}
}
/// <summary>
/// Gets or sets the name of the user.
/// </summary>
/// <value>The name of the user.</value>
public string UserName { get ; set; }
public Profile () : base ()
{
}
/// <summary>
/// Gets or sets a value indicating whether this <see cref="Yavsc.Model.RolesAndMembers.Profile"/> remember me.
/// </summary>
/// <value><c>true</c> if remember me; otherwise, <c>false</c>.</value>
public bool RememberMe { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="Yavsc.Model.RolesAndMembers.Profile"/> class.
/// </summary>
/// <param name="profile">Profile.</param>
public Profile (ProfileBase profile)
{
object b = profile.GetPropertyValue ("BlogVisible");
BlogVisible = (b == null) ? true : (b is DBNull)? true : (bool)b;
object s = profile.GetPropertyValue ("BlogTitle");
BlogTitle = (s is DBNull) ? null : (string)s;
s = profile.GetPropertyValue ("avatar");
avatar = (s is DBNull) ? null : (string)s;
s = profile.GetPropertyValue ("Address");
Address = (s is DBNull) ? null : (string)s;
s = profile.GetPropertyValue ("CityAndState");
CityAndState = (s is DBNull) ? null : (string)s;
s = profile.GetPropertyValue ("Country");
Country = (s is DBNull) ? null : (string)s;
s = profile.GetPropertyValue ("ZipCode");
ZipCode = (s is DBNull) ? null : (string)s;
s = profile.GetPropertyValue ("WebSite");
WebSite = (s is DBNull) ? null : (string)s;
s = profile.GetPropertyValue ("Name");
Name = (s is DBNull) ? null : (string)s;
s = profile.GetPropertyValue ("Phone");
Phone = (s is DBNull) ? null : (string)s;
s = profile.GetPropertyValue ("Mobile");
Mobile = (s is DBNull) ? null : (string)s;
UserName = profile.UserName;
s = profile.GetPropertyValue ("BankCode");
BankCode = (s is DBNull) ? null : (string)s;
s = profile.GetPropertyValue ("IBAN");
IBAN = (s is DBNull) ? null : (string)s;
s = profile.GetPropertyValue ("BIC");
BIC = (s is DBNull) ? null : (string)s;
s = profile.GetPropertyValue ("WicketCode");
WicketCode = (s is DBNull) ? null : (string)s;
s = profile.GetPropertyValue ("AccountNumber");
this.AccountNumber = (s is DBNull) ? null : (string)s;
s = profile.GetPropertyValue ("BankedKey");
BankedKey = (s == null) ? 0 : (s is DBNull)? 0 : (int)s;
s = profile.GetPropertyValue ("gcalid");
GoogleCalendar = (s is DBNull)? null : (string) s;
}
}
}

View file

@ -0,0 +1,74 @@
//
// ProviderPublicInfo.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// Copyright (c) 2015 Paul Schneider
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Web.Http;
using System.ComponentModel.DataAnnotations;
using Yavsc.ApiControllers.Calendar.Model;
namespace Yavsc.Model.RolesAndMembers
{
/// <summary>
/// Provider public info.
/// </summary>
public class ProviderPublicInfo {
/// <summary>
/// Gets or sets the display name.
/// </summary>
/// <value>The display name.</value>
[Required]
public string DisplayName { get; set; }
/// <summary>
/// Gets or sets the type of the location.
/// </summary>
/// <value>The type of the location.</value>
[Required]
public string LocationType { get; set; }
/// <summary>
/// Gets or sets the location.
/// </summary>
/// <value>The location.</value>
[Required]
public Position Location { get; set; }
/// <summary>
/// Gets or sets the logo image locator.
/// </summary>
/// <value>The logo image locator.</value>
public string LogoImgLocator { get; set; }
/// <summary>
/// Gets or sets the description.
/// </summary>
/// <value>The description.</value>
[Required]
public string Description { get; set;}
/// <summary>
/// Gets or sets the web page.
/// </summary>
/// <value>The web page.</value>
public string WebPage { get; set; }
/// <summary>
/// Gets or sets the calendar.
/// </summary>
/// <value>The calendar.</value>
public Schedule Calendar { get; set; }
}
}

View file

@ -0,0 +1,43 @@
//
// Publishing.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// Copyright (c) 2015 Paul Schneider
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Web.Http;
using System.ComponentModel.DataAnnotations;
namespace Yavsc.Model.RolesAndMembers
{
/// <summary>
/// Publishing.
/// </summary>
public enum Publishing {
/// <summary>
/// The private.
/// </summary>
Private,
/// <summary>
/// The public.
/// </summary>
Public
}
}

View file

@ -0,0 +1,71 @@
//
// RegisterClientModel.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// Copyright (c) 2015 Paul Schneider
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Yavsc.Model.RolesAndMembers
{
/// <summary>
/// Register client model.
/// </summary>
public class RegisterClientModel : RegisterModel
{
/// <summary>
/// Gets or sets the full name.
/// </summary>
/// <value>The full name.</value>
[DisplayName("Nom complet")]
[Required(ErrorMessage="S'il vous plait, saisissez le nom complet")]
public string Name { get; set; }
/// <summary>
/// Gets or sets the address.
/// </summary>
/// <value>The address.</value>
[DisplayName("Addresse")]
public string Address { get; set; }
/// <summary>
/// Gets or sets the state of the city and.
/// </summary>
/// <value>The state of the city and.</value>
[DisplayName("Ville")]
public string CityAndState { get; set; }
/// <summary>
/// Gets or sets the zip code.
/// </summary>
/// <value>The zip code.</value>
[DisplayName("Code postal")]
public string ZipCode { get; set; }
/// <summary>
/// Gets or sets the phone.
/// </summary>
/// <value>The phone.</value>
[DisplayName("Téléphone fixe")]
public string Phone { get; set; }
/// <summary>
/// Gets or sets the mobile.
/// </summary>
/// <value>The mobile.</value>
[DisplayName("Téléphone mobile")]
public string Mobile { get; set; }
}
}

View file

@ -0,0 +1,73 @@
//
// RegisterModel.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// Copyright (c) 2015 Paul Schneider
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Yavsc.Model.RolesAndMembers
{
/// <summary>
/// Register view model.
/// </summary>
public class RegisterModel
{
/// <summary>
/// Gets or sets the name of the user.
/// </summary>
/// <value>The name of the user.</value>
[Localizable(true), Required(ErrorMessage = "S'il vous plait, entrez un nom d'utilisateur")
,Display(ResourceType=typeof(LocalizedText),Name="UserName")]
public string UserName { get; set; }
/// <summary>
/// Gets or sets the password.
/// </summary>
/// <value>The password.</value>
[DisplayName("Mot de passe")]
[Required(ErrorMessage = "S'il vous plait, entez un mot de passe")]
public string Password { get; set; }
/// <summary>
/// Gets or sets the email.
/// </summary>
/// <value>The email.</value>
[DisplayName("Adresse e-mail")]
[Required(ErrorMessage = "S'il vous plait, entrez un e-mail valide")]
public string Email { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is approuved.
/// </summary>
/// <value><c>true</c> if this instance is approuved; otherwise, <c>false</c>.</value>
public bool IsApprouved { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="Yavsc.Model.RolesAndMembers.RegisterModel"/> class.
/// </summary>
public RegisterModel()
{
IsApprouved = false;
}
}
}

View file

@ -0,0 +1,21 @@
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Yavsc.Model.RolesAndMembers
{
/// <summary>
/// Register view model.
/// </summary>
public class RegisterViewModel : RegisterModel
{
/// <summary>
/// Gets or sets the confirm password.
/// </summary>
/// <value>The confirm password.</value>
[DisplayName("Confirmation du mot de passe")]
public string ConfirmPassword { get; set; }
}
}