aboutsummaryrefslogtreecommitdiffstats
path: root/include/account.php
diff options
context:
space:
mode:
authormrjive <mrjive@mrjive.it>2018-01-30 16:13:30 +0100
committerGitHub <noreply@github.com>2018-01-30 16:13:30 +0100
commit7ac4b477020689572a50dbc777c968263e86f6c4 (patch)
tree470336bcbdf0f989d48fb2c3349bd0ac0513da42 /include/account.php
parentc2abbe2c238fa4d66e8a088c7d271acaa7e20876 (diff)
parentd24cf0b85b24cb8d6d10e9fe66fed568f9fb08b2 (diff)
downloadvolse-hubzilla-7ac4b477020689572a50dbc777c968263e86f6c4.tar.gz
volse-hubzilla-7ac4b477020689572a50dbc777c968263e86f6c4.tar.bz2
volse-hubzilla-7ac4b477020689572a50dbc777c968263e86f6c4.zip
Merge pull request #13 from redmatrix/dev
Dev
Diffstat (limited to 'include/account.php')
-rw-r--r--include/account.php44
1 files changed, 33 insertions, 11 deletions
diff --git a/include/account.php b/include/account.php
index 6c6fdece4..3ac485974 100644
--- a/include/account.php
+++ b/include/account.php
@@ -262,24 +262,46 @@ function create_account($arr) {
function verify_email_address($arr) {
- $hash = random_string();
-
- $r = q("INSERT INTO register ( hash, created, uid, password, lang ) VALUES ( '%s', '%s', %d, '%s', '%s' ) ",
- dbesc($hash),
- dbesc(datetime_convert()),
- intval($arr['account']['account_id']),
- dbesc('verify'),
- dbesc($arr['account']['account_language'])
- );
+ if(array_key_exists('resend',$arr)) {
+ $email = $arr['email'];
+ $a = q("select * from account where account_email = '%s' limit 1",
+ dbesc($arr['email'])
+ );
+ if(! ($a && ($a[0]['account_flags'] & ACCOUNT_UNVERIFIED))) {
+ return false;
+ }
+ $account = $a[0];
+ $v = q("select * from register where uid = %d and password = 'verify' limit 1",
+ intval($account['account_id'])
+ );
+ if($v) {
+ $hash = $v[0]['hash'];
+ }
+ else {
+ return false;
+ }
+ }
+ else {
+ $hash = random_string(24);
+
+ $r = q("INSERT INTO register ( hash, created, uid, password, lang ) VALUES ( '%s', '%s', %d, '%s', '%s' ) ",
+ dbesc($hash),
+ dbesc(datetime_convert()),
+ intval($arr['account']['account_id']),
+ dbesc('verify'),
+ dbesc($arr['account']['account_language'])
+ );
+ $account = $arr['account'];
+ }
- push_lang(($arr['account']['account_language']) ? $arr['account']['account_language'] : 'en');
+ push_lang(($account['account_language']) ? $account['account_language'] : 'en');
$email_msg = replace_macros(get_intltext_template('register_verify_member.tpl'),
[
'$sitename' => get_config('system','sitename'),
'$siteurl' => z_root(),
'$email' => $arr['email'],
- '$uid' => $arr['account']['account_id'],
+ '$uid' => $account['account_id'],
'$hash' => $hash,
'$details' => $details
]