1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-30 15:42:48 -05:00

Provider qa feedback (#1501)

* Title case buttons

* Throw if provider tries to add a non-business organization

* Allow only one admin OR owner roll in a free org per user

Boolean operators were not properly assocated
and ownership of an org was precluding confirmation into any other
organization

* Limit email length

* Require email domain with top level domain

* Do not allow email domains to end in invalid characters

* Fix free org tests
This commit is contained in:
Matt Gibson
2021-08-10 12:16:10 -04:00
committed by GitHub
parent b726b08ea1
commit 5dc6013e37
7 changed files with 103 additions and 25 deletions

View File

@ -8,7 +8,7 @@
<tr style="margin: 0; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 16px; color: #333; line-height: 25px; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none;">
<td class="content-block" style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 16px; color: #333; line-height: 25px; margin: 0; -webkit-font-smoothing: antialiased; padding: 0 0 10px; -webkit-text-size-adjust: none; text-align: center;" valign="top" align="center">
<a href="{{{Url}}}" clicktracking=off target="_blank" style="color: #ffffff; text-decoration: none; text-align: center; cursor: pointer; display: inline-block; border-radius: 5px; background-color: #175DDC; border-color: #175DDC; border-style: solid; border-width: 10px 20px; margin: 0; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 16px; line-height: 25px; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none;">
Set up Provider Now
Set Up Provider Now
</a>
</td>
</tr>

View File

@ -6,6 +6,7 @@ namespace Bit.Core.Models.Api.Request
public class ProviderOrganizationCreateRequestModel
{
[Required]
[StringLength(256)]
[StrictEmailAddress]
public string ClientOwnerEmail { get; set; }
[Required]

View File

@ -1488,8 +1488,8 @@ namespace Bit.Core.Services
var orgUsers = keyedOrganizationUsers.GetValueOrDefault(user.Id, new List<OrganizationUser>());
try
{
if (organization.PlanType == PlanType.Free && orgUser.Type == OrganizationUserType.Admin
|| orgUser.Type == OrganizationUserType.Owner)
if (organization.PlanType == PlanType.Free && (orgUser.Type == OrganizationUserType.Admin
|| orgUser.Type == OrganizationUserType.Owner))
{
// Since free organizations only supports a few users there is not much point in avoiding N+1 queries for this.
var adminCount = await _organizationUserRepository.GetCountByFreeOrganizationAdminUserAsync(user.Id);

View File

@ -1,4 +1,5 @@
using System.ComponentModel.DataAnnotations;
using System.Text.RegularExpressions;
using MimeKit;
namespace Bit.Core.Utilities
@ -25,7 +26,12 @@ namespace Bit.Core.Utilities
return false;
}
}
catch (ParseException e)
catch (ParseException)
{
return false;
}
if (!Regex.IsMatch(emailAddress, @"@.+\.[A-Za-z0-9]+$"))
{
return false;
}