mirror of
https://github.com/documize/community.git
synced 2025-08-07 06:25:23 +02:00
PRovide basic in-app purchase/renewal flow
This commit is contained in:
parent
e116d3b000
commit
d1b803b246
39 changed files with 1211 additions and 1154 deletions
|
@ -51,10 +51,9 @@ func (h *Handler) Add(w http.ResponseWriter, r *http.Request) {
|
|||
method := "user.Add"
|
||||
ctx := domain.GetRequestContext(r)
|
||||
|
||||
if !h.Runtime.Product.License.IsValid(ctx.OrgID) {
|
||||
if !h.Runtime.Product.IsValid(ctx) {
|
||||
response.WriteBadLicense(w)
|
||||
}
|
||||
|
||||
if !ctx.Administrator {
|
||||
response.WriteForbiddenError(w)
|
||||
return
|
||||
|
@ -101,7 +100,7 @@ func (h *Handler) Add(w http.ResponseWriter, r *http.Request) {
|
|||
requestedPassword := secrets.GenerateRandomPassword()
|
||||
userModel.Salt = secrets.GenerateSalt()
|
||||
userModel.Password = secrets.GeneratePassword(requestedPassword, userModel.Salt)
|
||||
userModel.LastVersion = ctx.AppVersion
|
||||
userModel.LastVersion = fmt.Sprintf("v%s", h.Runtime.Product.Version)
|
||||
|
||||
// only create account if not dupe
|
||||
addUser := true
|
||||
|
|
|
@ -14,7 +14,6 @@ package user
|
|||
import (
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"github.com/documize/community/core/env"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
@ -313,7 +312,7 @@ func (s Store) ForgotUserPassword(ctx domain.RequestContext, email, token string
|
|||
}
|
||||
|
||||
// CountActiveUsers returns the number of active users in the system.
|
||||
func (s Store) CountActiveUsers() (c []env.LicenseUserAcount) {
|
||||
func (s Store) CountActiveUsers() (c []domain.SubscriptionUserAccount) {
|
||||
err := s.Runtime.Db.Select(&c, "SELECT c_orgid AS orgid, COUNT(*) AS users FROM dmz_user_account WHERE c_active=true GROUP BY c_orgid ORDER BY c_orgid")
|
||||
|
||||
if err != nil && err != sql.ErrNoRows {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue