aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/account.php11
-rw-r--r--mod/zregister.php19
-rw-r--r--view/css/mod_zregister.css2
3 files changed, 27 insertions, 5 deletions
diff --git a/include/account.php b/include/account.php
index ead8ce862..e978e64b0 100644
--- a/include/account.php
+++ b/include/account.php
@@ -141,6 +141,17 @@ function create_account($arr) {
return($result);
}
+ $r = q("select * from account where account_email = '%s' and password = '%s' limit 1",
+ dbesc($email),
+ dbesc($password_encoded)
+ );
+ if($r && count($r)) {
+ $result['account'] = $r[0];
+ }
+ else {
+ logger('create_account: could not retrieve newly created account');
+ }
+
$result['success'] = true;
$result['email'] = $email;
diff --git a/mod/zregister.php b/mod/zregister.php
index b8ed4c66b..0ce6b90ef 100644
--- a/mod/zregister.php
+++ b/mod/zregister.php
@@ -73,8 +73,14 @@ function zregister_post(&$a) {
notice($result['message']);
return;
}
+ require_once('include/security.php');
+ authenticate_success($result['account'],true,true);
+
+//???
+ // in fact we need the sponsor, not the user
$user = $result['user'];
+///
$using_invites = get_config('system','invitation_only');
$num_invites = get_config('system','number_invites');
@@ -83,9 +89,10 @@ function zregister_post(&$a) {
if($policy == REGISTER_OPEN ) {
- if($using_invites && $invite_id) {
- q("delete * from register where hash = '%s' limit 1", dbesc($invite_id));
- set_pconfig($user['uid'],'system','invites_remaining',$num_invites);
+ if($using_invites && $invite_code) {
+ q("delete * from register where hash = '%s' limit 1", dbesc($invite_code));
+// set $sponsor
+ set_pconfig($sponsor['uid'],'system','invites_remaining',$num_invites);
}
$email_tpl = get_intltext_template("register_open_eml.tpl");
@@ -104,6 +111,10 @@ function zregister_post(&$a) {
if($res) {
info( t('Registration successful. Please check your email for validation instructions.') . EOL ) ;
+
+
+
+
goaway(z_root());
}
}
@@ -133,7 +144,7 @@ function zregister_post(&$a) {
if($using_invites && $invite_id) {
q("delete * from register where hash = '%s' limit 1", dbesc($invite_id));
- set_pconfig($user['uid'],'system','invites_remaining',$num_invites);
+ set_pconfig($sponsor['uid'],'system','invites_remaining',$num_invites);
}
$email_tpl = get_intltext_template("register_verify_eml.tpl");
diff --git a/view/css/mod_zregister.css b/view/css/mod_zregister.css
index 2edb9e9a9..a5bd9a5cf 100644
--- a/view/css/mod_zregister.css
+++ b/view/css/mod_zregister.css
@@ -23,7 +23,7 @@ h2 {
.zregister-feedback {
float: left;
- margin-left: 5px;
+ margin-left: 45px;
}
.zregister-field-end {